title: running a batch file from another batch file as an admisitrator
body: <p>I need to run a batch file (setup.bat) which will call another batch file (make_dir.bat) which will create a folder in the "C:\Program Files" directory. This is for an internal installer. All the users will be logged in with their user names but will have local administrator rights. I've tried two approaches but neither work. </p>
  
  <p>Approach 1:</p>
  
  <pre><code>SET PRGFILES=%programfiles%\mySoftware
  SET admin=N
  SET domain=%USERDOMAIN%\
  IF /i "%domain%" EQU "%computername%\" set domain=
  SET user=%domain%%username%
  FOR /f "Tokens=*" %%a IN ('net localgroup administrators^|find /i "%user%"') DO SET admin=Y
  IF "%admin%"=="Y" (
      MD "%PRGFILES%"
  )
  </code></pre>
  
  <p>This says <code>Access is denied</code></p>
  
  <p>Approach 2:</p>
  
  <pre><code>runas /user:%Username% shell\make_dir.bat
  </code></pre>
  
  <p>where make_dir.bat is </p>
  
  <pre><code>md "%programfiles%\mySoftware"
  </code></pre>
  
  <p>This asks for the current username and password but somehow fails after that. I have checked that all users have local admin rights and can manually create a folder in their <code>programfiles</code> folder.</p>
  
  <p>Thanks for the help.</p>