title: Execute .bat file via CMD, asp.NET MVC 4
body: <p>I want to execute a .bat file via CMD on the IIS server where I publish these files. I put the batch files in the App_Data directory on the solution and set it to &quot;Copy always&quot; that I have it on the IIS from deploy.</p>
  <p>I also have a website (.cshtml), and if i call this website, it should proceed the cmd with the batch file. I done this with this code:</p>
  <pre><code>string filePath = HttpContext.Current.Server.MapPath(&quot;~/App_data/Auto_Deploy_&quot; + branch + &quot;.bat&quot;);
          ProcessStartInfo procStartInfo = new ProcessStartInfo(&quot;cmd.exe&quot;, &quot;/c &quot; + filePath);
          procStartInfo.WorkingDirectory = &quot;C:\\&quot;;
          procStartInfo.RedirectStandardOutput = true;
          procStartInfo.UseShellExecute = false;
          procStartInfo.CreateNoWindow = false;
          procStartInfo.RedirectStandardError = true;
  if (Environment.OSVersion.Version.Major &gt;= 6)
          {
              procStartInfo.Verb = &quot;runas&quot;;
          }
  
          procStartInfo.FileName = &quot;cmd.exe&quot;;
  </code></pre>
  <p>And I start the action with:</p>
  <pre><code>Process proc = new Process();
          proc.StartInfo = processStartInfo;
          proc.Start();
          proc.WaitForExit();
  </code></pre>
  <p>I also generated a app.manifest and edited the line</p>
  <pre><code>&lt;requestedExecutionLevel&gt;
  </code></pre>
  <p>to</p>
  <pre><code>&lt;requestedExecutionLevel level=&quot;requireAdministrator&quot; uiAccess=&quot;false&quot; /&gt;
  </code></pre>
  <p>because I think, that it should be done with Administrator rights.</p>
  <p>If I connect to the website from localhost (on the server), I direct to the webpage and this script should run, and post the output and errors on the screen.</p>
  <p>I get always the same error:</p>
  <blockquote>
  <p>Das System kann den angegebenen Pfad nicht finden.</p>
  <p><em>(The system could not find path.)</em></p>
  </blockquote>
  <p>Can you tell me where the problem is?</p>