windows - How to "pause" a batch script until a program is closed? -


i have seemingly trivial question can't figure out. writing batch script opens firefox specific url (which works) , more stuff (which works when executed in isolation). however, if put both commands in batch script, executed back-to-back. i need script wait until firefox closed, though. possible?

here's have:

echo step 1 start /wait "c:\program files (x86)\mozilla firefox\firefox.exe" http://www.google.com echo step 2 

i want see "step two" after close firefox. i found thread seems similar. adding /wait doesn't seem help. , don't quite know how adapt accepted solution needs.

any appreciated!

edit: how adapted scripted in thread linked produces same results:

echo step 1 start /wait "c:\program files (x86)\mozilla firefox\firefox.exe" http://www.google.com  :loop pslist firefox >nul 2>&1 if errorlevel 1 (   goto continue ) else (   echo firefox still running   sleep 5   goto loop )  :continue echo step 2 

but still produces same behavior. :s

try this:

echo step 1 "c:\program files (x86)\mozilla firefox\firefox.exe" http://www.google.com :s1 /f "tokens=*" %%a in (`tasklist /fi "imagename eq firefox.exe" /fi "status eq running"`) (if "%%~a" equ "info: no tasks running match specified criteria." goto s2) goto s1 :s2 echo step 2 

which should work


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -