views:

103

answers:

2

I'm using a batch file to stop a Windows service. I'm using the sc command, but I'm open to other ideas, given the question below. The problem is that the batch file proceeds while the service is stopping (the stop argument to sc seems only to request the stop -- it doesn't wait for the stop).

How can I modify the batch file to not proceed until the stop is complete?

+3  A: 

Use can use NET stop, which is synchronous, i.e it will wait until the service stops.

See - NET stop

mdma
A: 

I believe net stop [Service] should wait until the service has fully stopped before moving on. sc stop [Service] simply sends a "stop" message to the service.

LittleBobbyTables