title: Running elevated cmd.exe in batch script with elevate.exe
body: <p>I am writing a dos batch file for windows7 and it has many commands which need elevated access to run. For elevation I am using elevate.exe. I am doing like below - </p>
  
  <pre><code>set Elevation=elevate -wait cmd.exe /c 
  %Elevation% "cd /d %CD% &amp;&amp; xcopy /E /Y ...."
  %Elevation% "cd /d %CD% &amp;&amp; command 2 .."
  %Elevation% "cd /d %CD% &amp;&amp; command 3 .."
  %Elevation% "cd /d %CD% &amp;&amp; command 4 .."
  .....
  </code></pre>
  
  <p>My script calls elevate for cmd and then <code>cd /d %CD%</code> for each command as elevate changes the working path to /system32 I am forced to change the directory every time I run elevate. It also prompts user for "UAC" dialog for each elevate command, so for ten such command UAC prompts will come 10 times :cry:. Commands I am using are mix of DOS command(like xcopy, diskpart etc) and some other 3rd party executable. So there is two problem for which I need some help- </p>
  
  <ol>
  <li>How to call elevate for cmd.exe once and run rest of the command in same elevated console.</li>
  <li>How to change working directory once instead with every command. I think solution to first one will take care of this also.</li>
  </ol>
  
  <p>Any help is most welcome.</p>