title: launching SFC from within a C# app
body: <p>I have been searching and I cannot seem to get this work.  I am trying to launch SFC from a button in a C# app.  I am aware that it requires rights elevation and in the scope of what I am trying to do is behavior that I want.</p>
  
  <p>I have tried:
  <a href="https://stackoverflow.com/questions/7610727/to-run-cmd-as-administrator-along-with-command">To run cmd as administrator along with command?</a>
  <a href="https://stackoverflow.com/questions/16529713/running-cmd-as-administrator-with-an-argument-from-c-sharp">Running CMD as administrator with an argument from C#</a>
  and 
  <a href="https://stackoverflow.com/questions/4687214/c-sharp-how-to-run-a-processwith-arguments-through-an-administrator-elevated-c">C# how to run a process(with arguments) through an administrator elevated cmd</a></p>
  
  <p>The code I tried last was:</p>
  
  <pre><code>private void button6_Click(object sender, EventArgs e)
      {
          ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + "processNeedToRun")
          {
              RedirectStandardError = true,
              RedirectStandardOutput = true,
              UseShellExecute = false,
              CreateNoWindow = true,
              Verb = "runas"
          };
  
      }
  </code></pre>
  
  <p>I either get no process launching at all the cmd window flashes saying incorrect credentials or the command was incorrect.</p>
  
  <p>what am I doing wrong?</p>
  
  <p>Per the comment added I changed it to this:</p>
  
  <pre><code>private void button6_Click(object sender, EventArgs e)
      {
          ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + "sfc.exe /scannow")
          {
              RedirectStandardError = false,
              RedirectStandardOutput = false,
              UseShellExecute = true,
              CreateNoWindow = false,
              Verb = "runas"
          };
  
      }
  </code></pre>
  
  <p>and no change</p>
  
  <p>EDIT:</p>
  
  <p>So I managed to find a solution:</p>
  
  <p>I created a new console app, edited the manifest to require admin and did this</p>
  
  <pre><code>Process.Start("CMD.exe", " /c SFC /Scannow");
  </code></pre>
  
  <p>That does have the behavior I want.  Thanks for the help!</p>