How to add dependency on a Windows Service AFTER the service is installed

his can also be done via an elevated command prompt using the sc command. The syntax is:

sc config [service name] depend= <Dependencies(separated by / (forward slash))>

Note: There is a space after the equals sign, and there is not one before it. So if you want ServiceA to depend on both ServiceB and ServiceC--that is to say, ServiceA will not start until the other two have started--then you would use this:

sc config ServiceA depend= ServiceB/ServiceC

Edit: Also, if you want to remove all dependencies, you have to use the following syntax:

sc config ServiceA depend= /

Warningdepend= parameter will overwrite existing dependencies list, not append. So for example, if ServiceA already depends on ServiceB and ServiceC, if you run depend= ServiceD, ServiceA will now depend only on ServiceD. 

posted @ 2013-09-15 11:46  protorock  阅读(335)  评论(0编辑  收藏  举报