Page 1 of 1
How to move location of user shell folder Documents, Downloads,Pictures,....
Posted: 09 Dec 2022 04:39
by tobwz
As you know Windows 10 has special user folders for each user e.g.
MyDocuments
Downloads
MyPictures
MyMusic
.....
They point all to sub folders of the current user profile e.g
C:\Users\<username>\....
But these are only symbolic links to the real folders.
How can I change the target folder for e.g. MyDocuments to D:\mystuff\ from COMMAND LINE?
The only way I found so far is by editing the Registry at
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Is there a smart way from a dos batch script?
Re: How to move location of user shell folder Documents, Downloads,Pictures,....
Posted: 09 Dec 2022 21:55
by GeoffVass
This is two questions, really.
In Windows 2000, Microsoft changed the default profiles root from C:\Winnt\Profiles to "C:\Documents and Settings" and the folders were called "My Documents", "My Pictures" etc and then in Vista they changed it to C:\Users with folders called "Documents" and "Pictures" etc. But because, by then, a lot of programs had hard-coded references to the old Windows 2000/XP paths, they planted some junction points in the new location so the references would still resolve. Generally speaking you can remove those junction points as they don't really have a useful modern purpose -- that's the folders you see called "My Documents" etc. These are file system structures, nothing to do with the registry.
The actual locations of the shell folders (C:\Users\User\Documents) are in the registry as you noted. I find the best way to manually relocate the folders is to Cut and Paste in Explorer, because this process will move the files, update the registry correctly, and ensure the shell process (explorer.exe) knows about the new locations in memory. If you manually copy the files, then update the locations in the registry, this process can be fraught because Explorer itself might not pick up the changes. Sometimes if you log out immediately and log back in, the changes will stick.
So arguably, from batch you could robocopy the files, update the registry with reg add, "rd" the junction points and force a log out with shutdown.exe -l and most of the time that should work. But if it's a one-time operation, moving the folders via Explorer is much more reliable.