0
点赞
收藏
分享

微信扫一扫

c# 启动外部命令 隐藏窗口

颜路在路上 2022-07-28 阅读 67
编程语言

ProcessStartInfo.UseShellExecute 属性需要设置为true

Process proc = new Process();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.RedirectStandardError = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitForExit();

[参考]
​​​ProcessStartInfo.UseShellExecute 属性​​​​从Process.Start C#隐藏控制台窗口​​


举报

相关推荐

0 条评论