I need to run four batch scripts, (for testing purposes contsining just I'm timeout /t 10 /nobreak > NUL
.
I need to execute the files at the same time, and wait for all of them to finish, before repeating with a different set of batch scripts.
This is my code by now:
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.Start();
process.StandardInput.WriteLine(command);
process.StandardInput.Flush();
process.StandardInput.Close();
System.Diagnostics.Process.Start(command).WaitForExit();
//process.WaitForExit();
Console.WriteLine(process.StandardOutput.ReadToEnd());