How do I wait for a service/process to start before continuing a batch script?

Posted by Shane McD on Stack Overflow See other posts from Stack Overflow or by Shane McD
Published on 2010-06-09T10:20:08Z Indexed on 2010/06/09 10:22 UTC
Read the original article Hit count: 344

I am writing a windows batch script to uninstall some software. However I need to wait after the uninstaller has finished for a service to be restarted before continuing with the next uninstall.

I can make the script wait for the uninstaller to finsh using:-

for /f "usebackq" %%M in ('tasklist /nh /fi "imagename eq %process_1%"') do if not %%M==%ignore_result% goto 1

But I cannot for the life of me figure out how to get the script to then wait for a service to start before continuing the script and running more uninstalls.

I am open to any suggestions.

© Stack Overflow or respective owner

Related posts about Windows

Related posts about scripting