Skip to content

Instantly share code, notes, and snippets.

@swaters86
Created January 7, 2025 13:36
Show Gist options
  • Save swaters86/64c7a62abcbb4f56d2da176194889c27 to your computer and use it in GitHub Desktop.
Save swaters86/64c7a62abcbb4f56d2da176194889c27 to your computer and use it in GitHub Desktop.
# Replace placeholders with appropriate values
$serviceName = "YourServiceName"
$displayName = "Your Service Display Name"
$description = "This is the description of the service."
$executablePath = "C:\Path\To\YourExecutable.exe"
# Create the service
sc.exe create $serviceName binPath= "\"$executablePath\"" DisplayName= "\"$displayName\""
# Add a description (optional but recommended)
sc.exe description $serviceName "$description"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment