I have a batch script that looks like:
sc stop myservice
sc start myservice
it errors out because sc doesn't wait till the service is stopped. How do I restart a service with a script?
windows-command-promptwindows-service
I have a batch script that looks like:
sc stop myservice
sc start myservice
it errors out because sc doesn't wait till the service is stopped. How do I restart a service with a script?
Best Answer
The poster wants to ensure the service is stopped before trying to restart it. You can use a loop on the output of "sc query" doing something like this: