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

2022/6/16 1:21:29

本文主要是介绍c# 启动外部命令 隐藏窗口,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

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 属性



这篇关于c# 启动外部命令 隐藏窗口的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程