Tôi đang thực hiện một lệnh command prompt như sau:C# thực hiện lệnh shell và nhận được kết quả
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();
Làm thế nào để tôi nhận được đầu ra của lệnh?
Xem câu trả lời này làm thế nào để sử dụng 'ReadToEnd'method: http://stackoverflow.com/a/7160384/214222 –