title: Start a new process and Killing the current process
body: <p>I want to start a new process B.exe from the current executing process A.exe.</p>
  
  <p>And as soon as B.exe is launched I want to kill A.exe (the current executing process).</p>
  
  <p>Though I can start B.exe I cannot close my current process i.e A.exe.</p>
  
  <p>Code I use is:</p>
  
  <pre><code>//Start the BT Setup Process
  ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\TEST\B.exe");
  Process.Start(startInfo);
  
  //Terminate the FSA 
  Process[] myProcess = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
  foreach (Process process in myProcess)
  {
      process.CloseMainWindow();
      //all the windows messages has to be processed in the msg queue
      //hence call to Application DoEvents forces the MSG
      Application.DoEvents();
  }
  </code></pre>