Author Topic: How do I kill process in C#?  (Read 929 times)


  • Administrator
  • Full Member
  • *****
  • Posts: 69
How do I kill process in C#?
« on: October 24, 2011, 12:37:41 pm »
Use the KillProcess function given below: You need to just pass the process name. For example, to kill excel application, make a call to KillProcess("Excel"). Even if there are many instances of excel application, this function would kill all the processes with the same name.

using System.Diagnostics;

void KillProcess(string processName)
          Process[] proc = Process.GetProcessesByName(processName);
          foreach (Process p in proc)


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1