Skip to content

Kill A Certain Process in TaskManager using C#

July 6, 2010

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.