Kill A Running Process With .NET
By Robbe Morris
Quick tip on using the System.Diagnostics assembly to kill a windows process.
using System;
using System.Diagnostics;
public static void Kill(string processName)
{
foreach(Process process in Process.GetProcessesByName(processName))
{
if(!process.CloseMainWindow()) process.Kill();
}
}
Kill A Running Process With .NET (1524 Views)