通过C#执行外部程序而未显示控制台
作者:互联网
我正在尝试从C#控制台应用程序运行VLC,但不能.我知道还有其他类似的问题(例如Launching process in C# Without Distracting Console Window、C# Run external console application and no ouptut?和C#: Run external console program as hidden),从中我得出了以下代码:
Process process = new Process();
process.StartInfo.FileName = "C:\\Users\\XXXXX\\Desktop\\VLC\\vlc.exe";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
//process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.Arguments = " -I dummy";
process.Start();
但是,当我注释和取消注释WindowStyle行时,控制台仍会显示.
怎么了?
解决方法:
请尝试以下命令行开关.记录为here.
process.StartInfo.Arguments = "-I dummy --dummy-quiet";
标签:console-application,c 来源: https://codeday.me/bug/20191122/2060648.html