Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

"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."


No Format
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

...