Wait for a Windows program to start or exit (DOS Batch)


Two handy batch scripts that will wait for a program to be running or not running


Windows Versions
Tested on Windows 10 and Windows 11

Download wait_for_program_v1.zip

Examples

REM Wait for program to be running
REM Sleep 3 seconds then retry, rinse and repeat
call wait_for_program_running.bat MyProgram.exe 3

REM as above but silent so no messages appear in the DOS shell
call wait_for_program_running.bat MyProgram.exe 3 SILENT

REM similar to above but now we are waiting for the program to not be running

call wait_for_program_not_running.bat MyOtherProgram.exe 3 SILENT

I use these from a batch file in shell:startup folder to wait for various programs to be running or not running before I continue with the next step of my custom startup script.


Download wait_for_program_v1.zip


Scott Hollows

  • Oracle & Delphi software developer based in Perth, Western Australia
  • Australian Oracle User Group – National Committee Member
  • Australian Delphi User Group – National Committee Member

    LinkedIn_Logo

Published by

Leave a comment