there, I have two batch files: BatchA.bat , BatchB.bat BatchA.bat calls B1.bat , B2.bat , B3.bat and at the same time runs three batch files (three orders of execution of batch files do not matter). this is BatchA.bat :
start B1.bat start B2.bat start B3.bat
BatchB.bat calls B4.bat , B5.bat , B6.bat and simultaneously launches three batch files (three orders of execution of batch files do not matter). this is BatchB.bat :
start B4.bat start B5.bat start B6.bat
I use the C # console application to call BatchA.bat , BatchB.bat , but I need to make sure that BatchB.bat will not start until BatchA.bat is complete. In other words, I need to make sure that all B1.bat , B2.bat and B3.bat complete before I start BatchB.bat
This is the C # code:
proc.StartInfo.FileName = BatchA.bat; proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.Start(); proc.WaitForExit(); int exitCode = proc.ExitCode; proc.Close(); Console.WriteLine("Process Complete! exitCode: " + exitCode.ToString()); proc.StartInfo.FileName = BatchB.bat; proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.Start(); proc.WaitForExit(); exitCode = proc.ExitCode; proc.Close(); Console.WriteLine("Process Complete! exitCode: " + exitCode.ToString());
When I run this, all 6 batch files run at the same time. How to make sure that BatchA.bat not complete until all three small batch files are complete?
source share