Execute multiple batch files concurrently and monitor if their process is completed

This is the simplest and most efficient way to solve this problem:

(
start first.bat
start second.bat
start third.bat
) | pause

echo done!

In this method the waiting state in the main file is event driven, so it does not consume any CPU time. The pause command would terminate when anyone of the commands in the ( block ) outputs a character, but start commands don’t show any output in this cmd.exe. In this way, pause keeps waiting for a char until all processes started by start commands ends. At that point the pipe line associated to the ( block ) is closed, so the pause Stdin is closed and the command is terminated by cmd.exe.

Leave a Comment