Mega Code Archive

 
Categories / C# by API / System Diagnostics
 

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.rntsoft.com");     Console.Write("--> Hit a key to kill {0}...", ieProc.ProcessName);     Console.ReadLine();     try     {       ieProc.Kill();     }     catch{} // In case user already killed it...   } }