更新时间:2023-12-05 12:50:04
您可以轻松地使用捕捉所有邮件
you can easily catch all messages using
Process build = new Process();
...
build.StartInfo.UseShellExecute = false;
build.StartInfo.RedirectStandardOutput = true;
build.StartInfo.RedirectStandardError = true;
build.StartInfo.CreateNoWindow = true;
build.ErrorDataReceived += build_ErrorDataReceived;
build.OutputDataReceived += build_ErrorDataReceived;
build.EnableRaisingEvents = true;
...
和创建活动build_ErrorDataReceived
and create the Event build_ErrorDataReceived
static void build_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
string msg = e.Data;
if (msg != null && msg.Length > 0)
{
// in msg you have the line you need!
}
}
我添加了一个小例子
应用的截屏
解决方案文件(VS 2008)