Launch / kill a process : Process : Development C# Examples


C# Examples » Development » Process »

 

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.navioo.com");

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

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



Output

--> Hit a key to launch IE
--> Hit a key to kill IEXPLORE...


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Process