title: Batch file ren command access denied, but works when I type it myself
body: <p>I have a batch file that copies the files from where Windows stores its Lock Screen images and puts them into my own personal folder, then renames them as .jpg's so that I can use them as my active desktop backgrounds, but for some reason the &quot;ren&quot; command has stopped working (Access denied). However, if I open a command prompt myself and type the command, it works.</p>
  <p>It doesn't matter if I have the final destination folder open or not, I get the same results. I have also tried running the batch file as administrator and it didn't change anything.</p>
  <p>My code is below. For troubleshooting, I added two timeout commands just so it would stop after a couple steps to let me see what was happening. The batch file is saved here: &quot;C:\Users\Adam\Desktop&quot;</p>
  <pre><code>xcopy &quot;C:\Users\Adam\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets&quot; &quot;D:\Users\Adam\Pictures\Spotlight&quot; /y
  d:
  cd D:\Users\Adam\Pictures\Spotlight
  timeout /t 5 /nobreak
  ren *.* *.jpg
  timeout /t 30 /nobreak
  </code></pre>
  <p>Thanks in advance!</p>