0

Suppose I want to run the following commands:

START foo.exe 1
START foo.exe 2
START foo.exe 3

and then when they complete I want to run

START foo.exe 4
START foo.exe 5
START foo.exe 6

How do I write a bat/cmd file to do it? I think the stumbling point for this is how do I tell when the previous batch of commands has finished so I can start a new batch of commands...

Denis
  • 11,796
  • 16
  • 88
  • 150
  • Do you plan on making sure all 3 previous commands completed, then start the new set? – Gerhard Apr 16 '19 at 14:52
  • See if the answers at this [question](https://stackoverflow.com/questions/33584587/how-to-wait-all-batch-files-to-finish-before-exiting) help you. – Squashman Apr 16 '19 at 15:46
  • 1
    Possible duplicate of [How to wait all batch files to finish before exiting?](https://stackoverflow.com/questions/33584587/how-to-wait-all-batch-files-to-finish-before-exiting). Alternatively, you could use a known `WindowTitle` for each and parse the output from `TaskList`, or check the `CommandLine` from 'Win32_Process' and proceed from there, e.g. `WMIC Process Where "Name='foo.exe' And CommandLine!='foo.exe 1' And CommandLine!='foo.exe 2' And CommandLine!='foo.exe 3'"…`. – Compo Apr 16 '19 at 15:48
  • 2
    Do you really want to run three copies of the same executable supplied with different parameters and when those have finished, another run with a separate set of parameters, or do you want to run the same executable against a pool of parameters but have only 3 executables running at any one time? Or are you anticipating switching the executables at some stage? – Magoo Apr 16 '19 at 15:56

0 Answers0