2011-06-21 42 views

Trả lời

4

Các tài liệu MSDN documentation on Process.StandardOutput thấy một ví dụ

// Start the child process. 
Process p = new Process(); 
// Redirect the output stream of the child process. 
p.StartInfo.UseShellExecute = false; 
p.StartInfo.RedirectStandardOutput = true; 
p.StartInfo.FileName = "Write500Lines.exe"; 
p.Start(); 
// Do not wait for the child process to exit before 
// reading to the end of its redirected stream. 
// p.WaitForExit(); 
// Read the output stream first and then wait. 
string output = p.StandardOutput.ReadToEnd(); 
p.WaitForExit(); 

Bạn có thể muốn trích xuất các dòng sai số chuẩn là tốt.

+0

hoạt động tốt, cảm ơn! –

Các vấn đề liên quan