C#如何把一个软件路径传到DOS里

来源:百度知道 编辑:UC知道 时间:2024/09/23 05:06:03

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "CMD";
p.StartInfo.Arguments = @"/C D:\CheckModified\Demo.exe";
p.StartInfo.UseShellExecute = false; //关闭Shell的使用
p.StartInfo.RedirectStandardInput = true; //重定向标准输入
p.StartInfo.RedirectStandardOutput = true; //重定向标准输出
p.StartInfo.RedirectStandardError = true; //重定向错误输出
p.StartInfo.CreateNoWindow = true ; //设置不显示窗口

p.Start();

使用进程类,打开cmd程序。
有个input之类的方法,同样的也可以将命令行返回的数据取出。