Running multiple concurrent background processes then wait for all of them to terminate, on Windows

Create the three batch files below. Main.bat launches 1.bat and 2.bat

1.bat and 2.bat write out temporary files for which main.bat checks. While 1.bat and 2.bat are working, main.bat reports back that processing is still occurring. When you hit enter on either 1.bat or 2.bat's open window, the temporary file is deleted, and the program exits. This simulates processing stopping for that .bat file. If you do this for both 1 and 2.bat, main.bat reports to you that processing has completed for these processes. You can make 1.bat and 2.bat do anything you want, so long as you clear the temporary file when you are finished. At this point main.bat can do anything you want it to do as well.

1.bat

echo %time% > 1.tmp
pause
del 1.tmp
exit 

2.bat

echo %time% > 2.tmp
pause
del 2.tmp
exit

main.bat

@echo off
start "1" 1.bat
start "2" 2.bat
    @ping -n 1 127.0.0.1 > nul
:loop
@echo Processing......
if not exist *.tmp goto :next
    @ping -n 5 127.0.0.1 > nul
goto loop
:next
@echo Done Processing!

Simple enough, provided the processes don't need standard input or output. From the command line, or in a batch file:

process1 | process2 | process3 | process4

This will run all four processes simultaneously, and won't return until they've all exited. (Possible exception: if a process explicitly closes the standard output it might be treated as if it had exited. But that's unusual, very few processes do that.)

I'm not sure exactly how many processes you can launch simultaneously this way. I've tried up to ten.