大师们,
我正在努力使用 C# 中的基本函数。我不是开发专家,但我想针对给定的客户需求开发 PoC。欢迎您的指导。
我正在使用以下和平代码,但是,它没有按预期工作。
我想最小化打开psr.exe,但是windows样式好像被忽略了。
ProcessStartInfo proc = new ProcessStartInfo("psr.exe");
proc.Arguments = "/start /output ....;
proc.WindowStyle = ProcessWindowStyle.Minimized;
proc.RedirectStandardOutput = true;
proc.UseShellExecute = false;
proc.CreateNoWindow = true;
Process.Start(proc);
提前致谢。
最佳答案
使用 shellExecute true 并以管理员权限运行应用程序,
string fileName = @"C:\Program Files (x86)\RequiredApp.exe";
Process process = new Process();
process.StartInfo.Arguments = null;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.StartInfo.FileName = fileName;
process.StartInfo.UseShellExecute = true;
process.Start();
关于C# ProcessWindowStyle.Minimized 不适用于 PSR.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44291546/