- WaitForExit Method (Int32):
- true if the associated process has exited; otherwise, false.
- https://msdn.microsoft.com/en-us/library/ty0d8k56(v=vs.110).aspx
- UseShellExecute:
- true if the shell should be used when starting the process; false if the process should be created directly from the executable file. The default is true.
- https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.useshellexecute(v=vs.110).aspx
- ProcessStartInfo.RedirectStandardOutput:
- true if output should be written to Process.StandardOutput; otherwise, false. The default is false.
- https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput(v=vs.110).aspx
- ProcessStartInfo.RedirectStandardError:
- true if error output should be written to Process.StandardError; otherwise, false. The default is false.
- https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandarderror(v=vs.110).aspx
- CreateNoWindow:
- true if the process should be started without creating a new window to contain it; otherwise, false. The default is false.
- https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.createnowindow(v=vs.110).aspx
- CreateNoWindow works in conjunction with UseShellExecute as follows:
To run the process without any window:
ProcessStartInfo info = new ProcessStartInfo(fileName, arg); info.CreateNoWindow = true; info.UseShellExecute = false; Process processChild = Process.Start(info);
To run the child process in it’s own window (new console)
ProcessStartInfo info = new ProcessStartInfo(fileName, arg); info.UseShellExecute = true; // which is the default value. Process processChild = Process.Start(info); // separate window
To run the child process in the parent’s console window –-> This is what we are using
ProcessStartInfo info = new ProcessStartInfo(fileName, arg); info.UseShellExecute = false; // causes consoles to share window Process processChild = Process.Start(info);
- WindowStyle :
- is a recommendation passed to the process
- One of the enumeration values that indicates whether the process is started in a window that is maximized, minimized, normal (neither maximized nor minimized), or not visible. The default is Normal.