| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 119258 | 2011-07-13 20:59:00 | batch file help | Mike (15) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 1216579 | 2011-07-13 20:59:00 | I am creating a batch file to run as a scheduled task, where I need it to launch 3 processes to run simultaneously, but to not continue until all three have completed? I have been able to get them to each wait until the previous has completed (using CALL), or all three to launch at once (just launching the process without the CALL)... but I can't get it to do a combination. Is it possible? [Batch 1] call process1.bat call process2.bat call process3.bat call endprocess.bat [Batch 2] process1.bat process2.bat process3.bat endprocess.batIn Batch 1, each process will launch after the previous one has finished, and then when all three are completed it will run endprocess.bat. In Batch 2, each process and the endprocess.bat will launch at the same time. What I'm trying to do is get each process to launch at the same time, but the endprocess.bat to not occur until ALL THREE processes have completed... Cheers, Mike. |
Mike (15) | ||
| 1216580 | 2011-07-13 21:18:00 | You'll probably have to use tasklist or pslist or something to check for the processes existing and sleep while they do. | inphinity (7274) | ||
| 1216581 | 2011-07-13 21:49:00 | A clumsy shameteur way to do it would be to engineer one of the batch files to consistently take the longest to run, and consequently be the last to finish. It can then be the process to call the endprocess.bat routine. Another option is to have each batch set a file or flag upon completion. Once all 3 flags are set the endprocess batch can be allowed to proceed. |
Paul.Cov (425) | ||
| 1216582 | 2011-07-13 21:53:00 | Another option is to have each batch set a file or flag upon completion. Once all 3 flags are set the endprocess batch can be allowed to proceed.So far I think this will be the easiest solution... Mike. |
Mike (15) | ||
| 1216583 | 2011-07-13 22:16:00 | Yes. Set each process to write a sentinel file (s1,s2,s3), then delete it on completion. Your final process can be run when an "IF NOT EXISTS s?" test returns TRUE. |
fred_fish (15241) | ||
| 1 | |||||