我想打電話給使用的Process.Start命令提示符下命令,然後使用StandardOutput我想在我的應用程序中使用的StreamReader讀取,但是當我運行下面的程序,在MessageBox我只是尋找路徑,直到調試,我在參數中陳述的命令不會附帶說明。傳遞參數給的ProcessStartInfo類
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());
}
這裏my net view命令從不執行。
感謝@Joey:幫助很大 – Abbas
如果它回答了你的問題,爲什麼不點擊複選標記? – Almo