0

I am trying to create script that launches a game, waits till it closes, then runs one final command. Based on my research, I want to use the "/WAIT" flag but it doesn't seem to work :'(. Im on Windows 10 x64 fully updated.

Here is the script:

::FreeSoftwareServers

set keymapperdir="G:\JoyToKey\"
set keymapper=JoyToKey.exe
set p1profile="G:\JoyToKey\BLANK.cfg"
set defaultprofile="G:\JoyToKey\Basic.cfg"

start /d %keymapperdir% %keymapper% %p1profile%

start /WAIT /d "G:\SteamLibrary\steamapps\common\rocketleague\Binaries\Win32" RocketLeague.exe

::pause

start /d %keymapperdir% %keymapper% %defaultprofile%

Any ideas on how to accomplish my goal? Or whats not working? I was looking into while loops that look for the exe but that seems overkill and resource wasting. Thanks.

0

Well, I think the issue is with the fact that RocketLeague is a steam game so the exe calls steam, closes temporarily untill steam opens it, but thats just a guess. This function did work as expected with a non steam game. I wouldn't mind a code review, but I've decided to just do the "while loop" approach to see if the exe is running with a preface of timeout. I have tons of space resources on my home server so its not a huge deal.

Here is how I got it working:

::FreeSoftwareServers

set keymapperdir="G:\JoyToKey\"
set keymapper=JoyToKey.exe
set p1profile="G:\JoyToKey\BLANK.cfg"
set defaultprofile="G:\JoyToKey\Basic.cfg"

start /d %keymapperdir% %keymapper% %p1profile%

"G:\SteamLibrary\steamapps\common\rocketleague\Binaries\Win32\RocketLeague.exe"

TIMEOUT /T 5

SETLOCAL EnableExtensions
set EXE=RocketLeague.exe
:while1
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND
goto FIN
:FOUND
TIMEOUT /T 5
goto :while1
:FIN

start /d %keymapperdir% %keymapper% %defaultprofile%

I'm better w/ Bash so if this seems ridiculous and somebody has a better approach let me know and I'd accept an answer.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.