batch file - MS Windows: running several commands in parallel -
when running following command in windows 7...
for /l %%n in (1,1,20) start /b groovy -cp selenium-server-standalone-2.39.0.jar script.groovy box%%n
... expected 20 groovy processes started (almost) simultaneously. instead, i'm having no more 5 processes operating @ same time. when 1 script ends , whole number of running scripts becomes 4, 1 more script starting. far understand, it's gonna kind of limitation "start" command in windows.
question: options run 20 scripts simultaneously? 20 not magic number here. want rid of 5 scripts limitation introducing "start" command.
a note familiar selenium: couple of reasons, don't want use selenium grid run scripts simultaneously on several nodes.
thanks, racoon
the batch code executes program called waitapp.exe, passing in number each time.
@echo off /l %%n in (1,1,20) start "waiting:%%n" /b waitapp.exe %%n @echo on
c# code waitapp.exe
class program { static void main(string[] args) { int id = int.parse(args[0]); console.writeline("started #" + args[0]); thread.sleep(timespan.fromseconds(5 + id)); console.writeline("stopped #" + args[0]); } }
as can see following output, 20 instances being executed simultaneously.
started #6 started #3 started #10 started #11 started #12 started #18 started #7 started #8 started #20 started #4 started #13 started #19 started #14 started #1 started #15 started #9 started #16 started #17 stopped #1 stopped #2 stopped #3 stopped #4 stopped #5 stopped #6 stopped #7 stopped #8 stopped #9 stopped #10 stopped #11 stopped #12 stopped #13 stopped #14 stopped #15 stopped #16 stopped #17 stopped #18 stopped #19 stopped #20
Comments
Post a Comment