We can change the target location of My Documents folder by editing the registry key. In pre-Vista OS(XP, Server 2003), this folder is called ‘My documents‘. In Vista, Windows 7 and Server 2008 it’s renamed as ‘Documents‘ folder. We can use reg.exe utility from command line for changing the default location of Documents folder. The command is given below.
reg.exe add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t REG_SZ /d folder_new_location /f
Note that this command does not move/copy the existing contents of Documents folder to the new location.
An example command for changing my documents location is given below.
reg.exe add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t REG_SZ /d "d:\mydocs" /f
The above command will set the target folder for my documents as d:\mydocs.
Instead you can open registry editor by running regedit and manually change the registry value Personal
under the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Just a note, copying and pasting what you have there might not work, you need to replace the “ and ” with “.
Modified the command in the post. Now you can copy and paste the command, it would work fine. Thanks for pointing out the issue.
Will this also work on Windows 10? How do i change the rest of the user folders? (Downloads, Music etc)
Thanks in advance
If you browse to that registry folder “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders” you will see all the different names for the keys that correspond to the folders. Replace the “Personal” part with the desired folder
ie
reg.exe add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop /t REG_SZ /d "d:\mydocs" /f
i currently have all my user content on D drive except for app data which is still on C because i was told it works better there. when i clean install windows 10, I relocate the pointer for each folder by right clicking and adjusting locations tab. instead of me doing it that, way could i just go to this “User Shell Folders” location in reg edit and backup this location or back up the keys that are changed then just import/merge those keys back to clean installed system to point to my old data? i mean i guess its not a big deal, i could keep doing it my old way but this sounds quicker and easier to have reg-edit merge script that would do it in one click … any thoughts on this? is there a particular reason i would not want to do this?
I want to do a batch to not only change the default location of my documents from the command line using the registry key, but also move/copy the existing contents of Documents folder to the new location.
What do I need to add to the command line?
It didn’t work for me in Win 10, is there any other way to change the location?