Command prompt/batch file to set special folder locations (e.g. desktop)

Copper Contributor

I'm looking for a command or piece I can use in a Windows batch file to set the location of the special user folders (desktop, documents, downloads etc.). I can currently change this in Windows Explorer by right clicking on Desktop and changing the location from the default (C:\users\user\Desktop) to my alternative on the X: drive. However, I need the batch file to execute this change for me.

 

Many thanks

2 Replies

If you need to use a batch file, you can use a batch file to edit the registry keys for the shell folder locations at:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folder
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

Use with caution and backup. For safety, I like the mklink solution though.