title: C# Cancel Windows Shutdown Programmatically
body: <p>I have found online that I can schedule for windows to shutdown doing so:</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      // Shutdown
      Process.Start("shutdown", "/s /t 10");
  
  }
  private void button2_Click(object sender, EventArgs e)
  {
      // Cancel Shutdown
      Process.Start("shutdown /a");
  }
  </code></pre>
  
  <p>So I have tied to a button an even that calls the above.  Is there a way for me to tie to another button a command that will cancel this shutdown?</p>
  
  <p>I have search and haven;t found anything useful, I have found some stuff like </p>
  
  <pre><code>Process.Start("cmd.exe", "shutdown /a");
  or
  Process.Start("shutdown /a");
  </code></pre>
  
  <p>But neither of those seem to work.</p>
  
  <p>Calling Process.Start("shutdown /a"); results in</p>
  
  <p>An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll</p>