How To Terminate Process That Encounters An Error In C#.NET
Simply set the error data received and terminate the process. private void button2_Click( object sender, EventArgs e) { foreach (Process p in Process.GetProcesses()) { p.ErrorDataReceived += new DataReceivedEventHandler (p_ErrorDataReceived); } } void p_ErrorDataReceived( object sender, DataReceivedEventArgs e) { Process p = (Process)sender; p.Kill(); }