title: xcopy "Access denied" with /y /o /s /c /h
body: <p>I'm currently refining and updating my offline virus database updater for Malwarebytes. It's simply all the Malwarebytes data from C:\ProgramData\Malwarebytes (virus database, build number, etc) inside an SFX .exe archive set to run a batch file after successful extraction.</p>
  
  <p><strong>The Problem</strong></p>
  
  <p>My existing updater works by copying each file with individual xcopy commands, but this time I want it to simply copy the whole folder. But when trying to xcopy to C:\ProgramData, I get "Access denied" for everything.</p>
  
  <p>This occurs even though I'm using the /y and /o switches and running the .exe as Administrator (from the context menu) to achieve elevated permissions. I know that I'm hitting the right directory and that the update does work with a manual copy and paste of the folder. 
  Is it just that it's not possible to command-copy a folder to ProgramData in Windows 7?</p>
  
  <p><strong>Extra Information</strong></p>
  
  <p>Inside the SFX .exe archive, I have a folder called "Malwarebytes" and a batch file. This is the only relevant segment of the batch file (I have independently confirmed that the rest of it works):</p>
  
  <pre><code>xcopy "Malwarebytes" "C:\ProgramData\Malwarebytes"\ /y /s /c /h /o
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/FC7eA.png" alt="enter image description here"></p>