I need to do this in my C # program.
Process process = LaunchCommandWindow("Special args and environment set")
process.StandardInput.WriteLine("cmd1");
process.StandardInput.WriteLine("cmd2");
using (Streamreader sr = new ())
{ etc etc..}
My commands execute correctly, but the problem is that the Parse log code does not wait for cmd1 and cmd2 to complete. I canβt name the way out and the process. waitforexit because after parsing the logs I have more commands to execute.
Here's how to set up process startup information. LaunchCommandWindow ()
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Path.Combine(Environment.SystemDirectory, "cmd.exe");
startInfo.Arguments = "/K " + newEnvironmentArgs;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardInput = true;
Process process = new Process();
process.StartInfo = startInfo;
process.Start();
return process;
How do I get the parsing log code to wait for cmd2 to complete?
Thank.
source
share