Windows – How to make one service dependent on another in Windows 7

dependenciesservicewindowswindows 7windows-service

If I view properties for a service, I can see the "Dependencies" tab, but I can't assign other services to this tab.

I have two services that start on startup, a server and a database. The server depends on the database – if the db hasn't started, the server doesn't work. (However, it does actually fail as a service, so I can't use the Recovery tab.)

How do I make the second service dependent on the first service, so that they always start up in the correct order?

Best Answer

From a command prompt running with admin credentials:

sc config <server_service_name> depend= <database_service_name>

Read more at this sc.exe documentation.