Similar to @FreeSoftwareServers file, I needed to wait for a program to start that wasn't started by the batch file. Then wait several seconds to start a program that hooks onto the program I'm checking for. If you want the file to timeout after checking a certain amount of times, you could use a counter within the loop to limit the amount of times it loops.
SETLOCAL EnableExtensions set EXE=MYEXETOCHECK.exe :LOOPSTART FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND TIMEOUT /T 3 goto LOOPSTART :FOUND TIMEOUT /T 15 START HOOKINGPROGRAM.exe
SETLOCAL EnableExtensions set EXE=MYEXETOCHECK.exe :LOOPSTART FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND TIMEOUT /T 3 goto LOOPSTART :FOUND TIMEOUT /T 15 START HOOKINGPROGRAM.exe The first TIMEOUT determines how often the loop will repeat, searching for the program. This can be modified to fit your needs.