I need to run a console application from my windows application. The console application that I want to run is an embedded resource in my application, and I call it like this:
// Run the updater and grab its output Process Updater = new Process(); Updater.StartInfo.FileName = "C:\\tmp\\tmp.exe"; Updater.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; Updater.StartInfo.UseShellExecute = false; Updater.StartInfo.RedirectStandardOutput = true; Updater.Start(); string UpdaterOutput = Updater.StandardOutput.ReadToEnd(); Updater.WaitForExit();
It retrieves everything in order, and it works fine, and it also fully outputs its output ... but I still see how the console window quickly opens when it starts. I know that the console appears from this application because the console header is C:\tmp\tmp.exe . Is there any completely fault-tolerant way to hide a console application? I thought using ProcessWindowStyle.Hidden would do it, but apparently not.
Thanks.
c # process console-application invisible
Kratz
source share