So I have a console application that runs a command line process and then closes. For that second that the process gets called, I can see the window of the process pop up then disappear.
Is it possible to either:
My code currently:
var proc = new Process();
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardInput = true;
proc.Start();
proc.StandardInput.WriteLine(@"Navigate to Correct Folder");
proc.StandardInput.WriteLine(@"Run Outside Program");
Add that line :
proc.StartInfo.Arguments = " /c;
And that one :
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
I suspect that you're actually seeing the window of your console application, and not the process you're launching. Change the output type to Windows Application.
Here 'sa solution that will allow you to show the console still if you need to, for example, if something goes wrong and you want to alert the user.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.