Kill A Certain Process in TaskManager using C#
Precondition:
I have many processes that I can view on my Task Manager.
Then I want to kill Process that run the Microsoft Word Application.
How to view your Task Manager:
Just right click on your Taskbar and click Task Manager.
It will appear that Microsoft Word’s process’s name is “WinWord.exe”
So to kill it just apply, these code:
Process[] pros = Process.GetProcesses();
for (int i = 0; i < pros.Count(); i++)
{
if (pros[i].ProcessName.ToLower().Contains("winword"))
{
pros[i].Kill();
}
}
That’s a wrap.
Leave a Comment