title: How to terminate a command issued to cmd.exe
body: <p>I created a cmd process in which I display the output to a window.  I would like to be able to terminate the command like pressing Control-c in the command prompt.  </p>
  
  <pre><code>new ProcessStartInfo("cmd.exe");
  </code></pre>
  
  <p>The only option I can think of is to terminate the process.  Is this what pressing control-c does?  The problem with this is some user settings will be lost.  Two I can think of are prompt and the current directory.  could there be any others?  I can remember these and create a new process and reset them.  Or is there another way to simulate the interruption?</p>
  
  <p><a href="https://i.stack.imgur.com/5c573.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>You can start a process by calling the <strong>Start</strong> method.  You can also end the process by calling the <strong>Kill</strong> method.  All well and good.  Now lets start a process by running cmd.exe and redirecting the input and output.  So now assume we execute a command that takes a long time.  It would be nice to cancel the command like we can do in a DOS window (Command Prompt) instead of forcing the user to close and reopen the app losing their history in the process.</p>
  
  <p>I can provide more details if necessary.</p>