C# ProcessWindowStyle.Minimized 不适用于 PSR.exe

标签 c# minimize

大师们,

我正在努力使用 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/

相关文章:

c# - 带有 Web API 2 的 Autofac - 无参数构造函数错误

c# - 十次 Thread.Sleep(100) 还是一次 Thread.Sleep(1000)?

c# - 阅读器关闭时无效的阅读尝试

c# - 通用委托(delegate) C#

html - 当用户最小化浏览器窗口时,如何使我的 CSS/HTML 类别菜单优雅地最小化?

c++ - C++ 中如何使用 Win32 API 将窗口最小化到系统托盘?

javascript - 单击链接时 IE 随机最小化

c# - WPF - 是否可以(以编程方式)禁用多点触控?

c# - 最小化WPF中的窗口?

vb.net - 如何最小化和恢复大量实例的进程?