Kill some processes by .exe file name

Aliasghar Yaghoobzadeh picture Aliasghar Yaghoobzadeh · Jul 27, 2010 · Viewed 177.3k times · Source

How can I kill some active processes by searching for their .exe filenames in C# .NET or C++?

Answer

ConsultUtah picture ConsultUtah · Jul 27, 2010

Quick Answer:

foreach (var process in Process.GetProcessesByName("whatever"))
{
    process.Kill();
}

(leave off .exe from process name)