How do I hide a console application user interface when using Process.Start?
.net, c#
Solution
Process p = new Process();
StreamReader sr;
StreamReader se;
StreamWriter sw;
ProcessStartInfo psi = new ProcessStartInfo(@"bar.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.CreateNoWindow = true;
p.StartInfo = psi;
p.Start();
This will start a child process without displaying the console window, and will allow the capturing of the StandardOutput, etc.
Problem
I want to run a console application that will output a file. I user the following code: ``` Process barProcess = Process.Start("bar.exe", @"C:\foo.txt"); ``` When this runs the console window appears. I want to hide the console window so it is not seen by the user. Is this possible? Is using Process.Start the best way to start another console application?