start 1.bat
start 2.bat
start /wait 3.bat
start 4.bat
start 5.bat
start /wait 6.bat
And so on. This assumes that the batch-file with the /wait
switch is the one to take longest. If that is not possible you can use this script here:
@echo off
start bat1.bat
start bat2.bat
start bat3.bat
call waitForFinish
start bat4.bat
start bat5.bat
start bat6.bat
call waitForFinish
Goto:eof
:waitForFinish
set counter=0
for /f %%i in ('tasklist /NH /FI "Imagename eq cmd.exe') do set /a counter=counter+1
if %counter% GEQ 2 Goto waitForFinish
After starting 3 batch-files you call the "function" waitForFinish
. This checks whether it finds more than 1 running command-line-process (one is used for the running batch-file so it will always be present and one additional line is above the output) and counts up for each window it finds.
If that counter is greater than 2 it will do the same again and again up to the point where only the running batch-file window is the only cmd.exe process found. If that is the case, the script returns to the top part of the script to start the next three.