Change My documents default location from command line using registry key

by admin on August 25, 2010

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

{ 2 comments… read them below or add one }

Mike December 30, 2011 at 3:39 am

Just a note, copying and pasting what you have there might not work, you need to replace the “ and ” with “.

Reply

admin December 30, 2011 at 6:28 am

Modified the command in the post. Now you can copy and paste the command, it would work fine. Thanks for pointing out the issue.

Leave a Comment

Previous post:

Next post: