我执行命令提示符下命令如下:C#执行shell命令并获得结果
string cmd = "/c dir" ;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "cmd.exe"
proc.StartInfo.Arguments = cmd;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
如何我得到命令的输出?
查看如何使用'ReadToEnd'method这样的回答:http://stackoverflow.com/a/7160384/214222 – 2013-04-04 20:31:41