I have a quick question - I want to modify the batch file you have running so that I can play FFVII through Steam. You use /wait, but simply swapping out ff7.exe with Steam.exe -gameidlaunch RANDOMNUMBERS will cause FF7Music to close immediately after Steam starts up ff7.exe. Is there a way to wait for the process tree to end, or am I SOL?
If you preface your exe calls with "START", it'll run the executable, then immediately continue processing operations without waiting for it to end.
I hope that answers your question.
Not quite, I'm not really all that familiar with batch files. I want the batch file to wait until ff7.exe is closed to close FF7Music, but since I'm running ff7.exe through Steam I can't use your method, "start /wait ff7.exe". I tried simply replacing it with "start /wait Steam.exe -gameidlaunch 13360084996509925376" but then it only waits for Steam to complete that command, rather than waiting for ff7.exe to terminate. From what I understand, I can't just use /wait by itself, it's a part of the Start command. Is there a way to wait on a process that I haven't called in the batch?
Maybe I should rephrase. Is there a way to check if a process is running?
I see what you're trying to do now...
A batch file can only do one thing at a time, it's like a console window with a bunch of commands already queued in, it executes one program, then when that program returns, it goes on to it's next instruction, the only way it can execute something *without* waiting for it to end is if you use the "Start" command, which essentially opens a new console behind the scenes and executes the program using that. Calling "Start /wait ff7.exe" is essentially the same as calling "ff7.exe".
So basically, the batch file isn't checking to see if the process is still running, it's actually running the process itself, and it can't continue until it finishes, but when you call "Steam.exe -[a bunch of numbers]", the batch file isn't running ff7.exe, it's running steam.exe, and it'll continue when steam.exe returns, which apparently is right away. That being said, I don't believe Windows has any command line functions that check to see if a program is running, then halt execution until the program terminates. If there was a way to do it, it'd have to be through some setting in Steam, since steam.exe is the only application that would get some kind of notification when ff7.exe closes.