title: Run Batch file as administrator - Windows 7 - Command "Run As" from network file system
body: <p>I need to set up the delivery of a program installer.</p>
  
  <p>This program has a program_installer.exe and a folder that i cannot include in the installer at the time in which i create the installer.</p>
  
  <p>therefore, when a user needs to install the program i send him a BATCH file via MAIL</p>
  
  <pre><code>@echo off
  if DEFINED PROGRAMFILES(X86) (
  SET TOOL_INSTALL_DIR="%PROGRAMFILES(X86)%\myfolder"
  ) else (
  SET TOOL_INSTALL_DIR="%PROGRAMFILES%\myfolder"
  )
  
  MKDIR %TOOL_INSTALL_DIR%
  copy /y \\rk0012352\Public\lkh5iwwh.m4s %TOOL_INSTALL_DIR%
  
  
  START %PROGRAMFILES%\program_installer.exe
  </code></pre>
  
  <p>The issue is that, when the user execute the BATCH and run COPY command, on windows 7 the command will fail because he has no ADMIN rights.</p>
  
  <p>How can i make that copy command run as administrator on both XP and 7 ?</p>
  
  <p>You might say: when the user gets the EMAIl with INSTALL.BAT, CAN'T he click RUN AS ADMINISTRATOR?</p>
  
  <p>The answer unfortunately is that most of them will not do that and just complain that it doesn't work. Moreover many email client such as Outlook will prompt "open" "save" choice panel and most of the users will click Open directly(generating the no rights error)</p>
  
  <p>the "run as" commands requires to specify the administrator name for the machine and i cannot know how the admin user is called on every computer.</p>
  
  <p>Any suggestion?</p>