2

How do this?

z1.bat z2.bat z3.bat z4.bat z5.bat z6.bat z7.bat ... z20.bat

How to run multithread? 5 files run, finish; next 5 files run, finish; next...

user2976880
  • 61
  • 1
  • 6

1 Answers1

2
setlocal enableDelayedExpansion
for /l %%b in (1=1=20) do (
      set /a wait_bat=%%b%%5
      if !wait_bat! equ 0 (
        start /w z%%b.bat
      ) else (
         start z%%b.bat
      )

)
endlocal
npocmaka
  • 55,367
  • 18
  • 148
  • 187
  • No, this assumes that the 5th process does not finish before the others. If running 10 script, you could end up with 9 running simultaneously if the 5th is very fast compared to others. – dbenham Nov 13 '13 at 00:46