I have a seemingly trivial question but can't figure it out. I am writing a batch script that opens Firefox with a specific URL (which works) and then does more stuff (which also works when executed in isolation). However, if I put both commands together in a batch script, they get executed back-to-back. I need the script to wait until Firefox is closed, though. Is that possible?
Here's what I have:
echo step one
start /wait "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" http://www.google.com
echo step two
I want to only see "step two" after I close Firefox. I found this thread which seems very similar. But adding /wait
doesn't seem to help. And I don't quite know how to adapt the accepted solution to my needs.
Any help would be greatly appreciated!
EDIT: This is how I adapted the scripted in the thread I linked to but it produces the same results:
echo step one
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 is still running
SLEEP 5
GOTO LOOP
)
:CONTINUE
echo step two
But that still produces the same behavior. :s