title: How to close an external application using c#
body: <p>Im trying to be close the calculator when the user press's a key on the key board. But p.kill and p.CloseMainWindow doesn't kill the calculator, only the shell which is executed. </p>
  
  <pre><code>Process p = new Process();
  p.StartInfo.FileName = "cmd";
  p.StartInfo.Arguments = "/c calc ";
  p.StartInfo.CreateNoWindow = true;
  p.StartInfo.UseShellExecute = false;
  p.Start();
  Console.WriteLine("Press any key to kill Calc");
  Console.ReadKey();
  p.CloseMainWindow();
  
  p.Kill();
  </code></pre>