0
@echo on

reg export "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal" C:\%username%.reg

pause

I wrote this simple batch to just copy the reg of shell folders. The folder obviously exist because I can see it, but it says invalid path when trying to run it.

Any suggestions? Thanks in advance.

1

Two problems:

  • Personal is the name of a value inside the key of HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, while the reg export command expects a key-name.

  • The root folder of C:\ is protected against writes.

The correct syntax is:

reg export "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" C:\some-folder\%username%.reg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.