【发布时间】:2012-06-14 20:29:19
【问题描述】:
我想使用 Process.Start 调用命令提示符命令,然后使用 StandardOutput 我想在我的应用程序中使用 StreamReader 进行读取,但是当我运行下面的程序时,在 MessageBox 中我只是找到了 Debug 之前的路径,我的命令我已经在论据中声明不会执行。
ProcessStartInfo info = new ProcessStartInfo("cmd.exe", "net view");
info.UseShellExecute = false;
info.CreateNoWindow = true;
info.RedirectStandardOutput = true;
Process proc = new Process();
proc.StartInfo = info;
proc.Start();
using(StreamReader reader = proc.StandardOutput)
{
MessageBox.Show(reader.ReadToEnd());
}
这里我的 net view 命令永远不会执行。
【问题讨论】:
标签: c# .net processstartinfo redirectstandardoutput