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
As mentioned above, NET STOP will send a stop command to the service, but, if the service takes more than a certain time (20 seconds or so is my observation), NET STOP will NOT wait for the service to actually stop before returning.
To actually pause the batch file until the service stops, you need to use an approach like those outlined in these threads:
How to check if a service is running via batch file and start it, if it is not running?
Stopping/Starting a remote Windows service and waiting for it to open/close