Note that most cases it is better to use
But in a case like the following, with no alternative this snippet can work.
"The above will start the calculator and wait before continuing. However if you replace calc.exe with Winword.exe, to run Word instead, then the /wait will stop working, this is because Winword.exe is a stub which launches the main Word application and then exits."
TIMEOUT /T 10 :: Set timeout for how long it takes to launch the exe you want to monitor SETLOCAL EnableExtensions set EXE=EXAMPLE.exe :while1 FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND echo Not running pause goto FIN :FOUND TIMEOUT /T 5 echo Timeout Done goto :while1 :FIN echo THIS IS FIN pause