Page 1 of 1

Start, wait, start, wait till exit, then start batch file?

Posted: 09 Jan 2021 17:35
by cnells2000
Hello everyone! im trying to make a batch file that once started, it closes a program then loads another. and i want it to wait as long as possible until i manually exit out of the 2nd program before it starts the 1st program back again. please help

Code: Select all

timeout 3

taskkill /F /IM "gameex.exe" /T

timeout 2

start /wait "" "D:\Launchbox\bigbox.exe"

timeout 2

start "" "D:\GameEx\gameex.exe"


It seemed it worked to the letter but it did not wait until big box is exited before it started up gameex again. it just waited 2 seconds and then started gameex along side it so now they are both running simultaneously

I NEED it to wait until big box is fully exited before it loads gameex again. so if i happen to be on big box for 3 ,5, 7 hours, when i escape out of it. continue batch and load gameex.

Re: Start, wait, start, wait till exit, then start batch file?

Posted: 09 Jan 2021 17:57
by Squashman
Some programs will not respect the wait option of the START command. In your instance you really don't need use the START command at all.

Re: Start, wait, start, wait till exit, then start batch file?

Posted: 10 Jan 2021 21:23
by Aacini
Try this:

Code: Select all

taskkill /F /IM "gameex.exe" /T

D:\Launchbox\bigbox.exe

start "" "D:\GameEx\gameex.exe"
This Batch file closes gameex.exe, then executes bigbox.exe, then waits until bigbox.exe is terminated, either manually or by any other method, to pass to the next line (that, by the way, is the standard method used by Batch files to execute commands: wait until a command ends in order to pass to the next).

After bigbox.exe ends, start gameex.exe...

Antonio