Page 1 of 1

run command in a loop

Posted: 22 Sep 2021 01:02
by dosW10
Hi,
I am having an executable called myExe. The command format to run it is : myExe X Y. X is from 0 to 5 and Y is from 0 to 3. To run these manually i need like 24 dos shell command windows for covering the entire parameter set. Each window run its own command. I need to monitor the 24 windows at the same time. Now, i have been trying to automate this with not much luck. I like a batch file that runs myExe within two loops with first loop iterates from 0 to 5 as first parameter and second one iterates from 0 to 3 as second parameter. Each time MyExe is called with its x and y setting, it creates a new window , returns immediately, with each window showing its own output. With sleep of 5 seconds between the next command. At the end I should end up with 24 shell windows seeing output lines in each. I was able to make it run once but was running sequentially which is NOT what I want.

Re: run command in a loop

Posted: 22 Sep 2021 02:16
by aGerman
untested:

Code: Select all

for /l %%X in (0 1 5) do (
  for /l %%Y in (0 1 3) do (
    start "result for %%X - %%Y" cmd /k myExe %%X %%Y
  )
)
Not sure about the 5s delay you mentioned. If necessary add a >nul timeout /t 5 /nobreak into the inner loop.

Steffen