Skip to content

Instantly share code, notes, and snippets.

@pmolchanov
Created May 13, 2015 07:29
Show Gist options
  • Save pmolchanov/16daa236aef94a5cf690 to your computer and use it in GitHub Desktop.
Save pmolchanov/16daa236aef94a5cf690 to your computer and use it in GitHub Desktop.
Install a service
$ServiceExe = "MyService.exe"
$ServiceName = "MyService"
$ServiceDisplayName = "MyService DisplayName"
$ServiceBinPath = [System.IO.Path]::GetFullPath($ServiceExe)
& sc.exe delete $ServiceName
& sc.exe create $ServiceName binPath= "`"$ServiceBinPath`"" DisplayName= "`"$ServiceDisplayName`""
& sc.exe start $ServiceName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment