title: How to run command line with admin right in C#
body: <p>I have referenced some other topics and it comes up the following coding, yet it doesn't work. I allow it creates command window and use "/k" argument keeping the window opened so that I can trace its output.</p>
  
  <p>However, I can see the warning from the window that the command needs admin rights to execute. How can I execute it in admin rights?</p>
  
  <pre><code>public void ClearArpCache () {
          ProcessStartInfo processStartInfo = new ProcessStartInfo("cmd.exe", "/user:Administrator \" cmd /k arp -d \""); // same as "netsh interface ip delete arpcache"
          processStartInfo.RedirectStandardOutput = true;
          //processStartInfo.CreateNoWindow = true;
          //processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
          processStartInfo.UseShellExecute = false;
          processStartInfo.StandardOutputEncoding = Encoding.Default;
          processStartInfo.Verb = "runas";
  
          Process.Start (processStartInfo);
          UnityEngine.Debug.Log ("ARP table cache cleared.");
      }
  </code></pre>
  
  <p>EDITED:</p>
  
  <p>Try changing from "cmd.exe" to "runas.exe"</p>
  
  <pre><code>public void ClearArpCache () {
          ProcessStartInfo processStartInfo = new ProcessStartInfo("runas.exe", "/user:Administrator \" cmd /k arp -d \""); // same as "netsh interface ip delete arpcache"
          processStartInfo.RedirectStandardOutput = true;
          //processStartInfo.CreateNoWindow = true;
          //processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
          processStartInfo.UseShellExecute = false;
          processStartInfo.StandardOutputEncoding = Encoding.Default;
  
          Process.Start (processStartInfo);
          UnityEngine.Debug.Log ("ARP table cache cleared.");
      }
  </code></pre>