Skip to content

Instantly share code, notes, and snippets.

@vgerbase
Last active August 6, 2017 14:47
Show Gist options
  • Save vgerbase/2abbd52e30934959e5d937c420f7193b to your computer and use it in GitHub Desktop.
Save vgerbase/2abbd52e30934959e5d937c420f7193b to your computer and use it in GitHub Desktop.
Create a dependency on a Windows service
@Echo Off
Cls
:CheckServiceName
If "%~1"=="" Goto AskServiceName
Set Service=%~1
Goto CheckDependencyServiceName
:AskServiceName
Echo Enter the service name
Set /p Service=
If "%Service%"=="" Goto Error
:CheckDependencyServiceName
If "%~2"=="" Goto AskkDependencyServiceName
Set DependencyService=%~2
Goto Process
:AskkDependencyServiceName
Echo Enter the dependency service name
Set /p DependencyService=
If "%DependencyService%"=="" Goto Error
:Process
sc config "%Service%" depend= "%DependencyService%"
Pause
Goto :eof
:Error
Echo Sintax: DependencyService.bat Service DependencyService
Echo.
Pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment