I am running Windows 10, using a batch file to run multiple processes as shown below. Each command solves a finite element analysis model that takes an unpredictable amount of time typically in the range of 1 to 5 hours. My computer is capable of running two analyses simultaneously, so I use the start
command in every other command.
start programName param1
programName param2
start programName param3
programName param4
etc...
My problem is that the third command doesn't start until both the first and second commands are finished. I prefer that there would be two commands running at all times.
I have considered running two batch files simultaneously instead as shown below, but then one batch file might finish while the other still has multiple commands waiting to run.
[batch1.bat]
programName param1
programName param2
etc...
[batch2.bat]
programName param3
programName param4
etc...
Is there an easy existing method to ensure that there are always exactly two commands running in parallel? If not, I will probably work on hacking something together in c++ using the system
command.