Process.Kill() : Process « System.Diagnostics « C# / C Sharp by API






Process.Kill()

 

using System;
using System.Diagnostics;

class MainClass
{

  static void Main(string[] args)
  {
    Console.Write("--> Hit a key to launch IE");
    Console.ReadLine();

    // Launch IE.
    Process ieProc = Process.Start("IExplore.exe", "www.java2s.com");

    Console.Write("--> Hit a key to kill {0}...", ieProc.ProcessName);
    Console.ReadLine();

    try
    {
      ieProc.Kill();
    }
    catch{} // In case user already killed it...
  }
}

   
  








Related examples in the same category

1.Process.CloseMainWindow
2.Process.Exited
3.Process.GetCurrentProcess()
4.Process.GetProcessById
5.Process.Modules
6.Process.PeakWorkingSet64
7.Process.PriorityClass
8.Process.PrivateMemorySize
9.Process.ProcessName
10.Process.StandardOutput.ReadToEnd()
11.Process.Start
12.Process.StartInfo.RedirectStandardOutput
13.Process.Threads
14.Process.TotalProcessorTime
15.Process.VirtualMemorySize
16.Process.WaitForExit
17.Process.WorkingSet