Mega Code Archive

 
Categories / C# Tutorial / Development
 

Launch kill a process

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...   } } -- Hit a key to launch IE -- Hit a key to kill IEXPLORE...