Computer Hope

Microsoft => Microsoft Windows => Windows XP => Topic started by: pman on July 23, 2008, 08:07:36 PM

Title: Registry setting for "My Documents" folder location
Post by: pman on July 23, 2008, 08:07:36 PM
Hi, Would you be able to tell me where in the registry the settings are that stores the location of "My Documents" folder. I know you can change it by going to the properties of this folder and changing the target field, but how can I do it through the registry settings.

Just trying to find an automated way of doing it instead of manual process. I've been googling about this registry setting, but can't find any.
Title: Re: Registry setting for "My Documents" folder location
Post by: Broni on July 23, 2008, 08:37:25 PM
You don't have to play with registry:
http://support.microsoft.com/kb/310147
Title: Re: Registry setting for "My Documents" folder location
Post by: pman on July 24, 2008, 05:41:51 AM
Hi Broni,

I actually read that page before. Whatever is mentioned in that page, requires manual process. You have to right click->select properties->change the path in the target field, etc.

I'm trying to do all that through a vbscript or any other script so that no manual process is necessary.
Title: Re: Registry setting for "My Documents" folder location
Post by: Sidewinder on July 24, 2008, 06:34:07 AM
Quote
I'm trying to do all that through a vbscript or any other script so that no manual process is necessary.

This is pretty much boilerplate code. My Documents has subfolders (My Music, My Videos, etc) which are not processed by this script.

Code: [Select]
Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
 
Set objRegistry=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
 
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
strValueName = "Personal"
strValue =                     'new value goes here (quoted)

objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

You will need to set the value of strValue before running the script. When messing with the registry, I suggest a system restore point or exporting the affected registry branch to a file. You can never be too careful.

 8)


Title: Re: Registry setting for "My Documents" folder location
Post by: soybean on July 24, 2008, 07:31:09 AM
Hi Broni,

I actually read that page before. Whatever is mentioned in that page, requires manual process. You have to c, etc. right click->select properties->change the path in the target field

I'm trying to do all that through a vbscript or any other script so that no manual process is necessary.
Strange reasoning, very strange.  How is your idea doing this via the registry any less manual than "right click->select properties->change the path in the target field"?  Your're going spend a lot more time figuring out how to do this your way than the way Microsoft has provided to easily do it.  Also, I don't know why you even call "right click->select properties->change the path in the target field" a manual process.  Indeed, I see your way as more manual than the Move procedure that's readily available.
Title: Re: Registry setting for "My Documents" folder location
Post by: Spoiler on July 24, 2008, 08:08:43 AM
You also can set a group policy in a AD domain. This would force the change to move the My Docs folder to say a server that could be backed up to tape.

Title: Re: Registry setting for "My Documents" folder location
Post by: pman on July 24, 2008, 06:29:28 PM
Hi Broni,

I actually read that page before. Whatever is mentioned in that page, requires manual process. You have to c, etc. right click->select properties->change the path in the target field

I'm trying to do all that through a vbscript or any other script so that no manual process is necessary.
Strange reasoning, very strange.  How is your idea doing this via the registry any less manual than "right click->select properties->change the path in the target field"?  Your're going spend a lot more time figuring out how to do this your way than the way Microsoft has provided to easily do it.  Also, I don't know why you even call "right click->select properties->change the path in the target field" a manual process.  Indeed, I see your way as more manual than the Move procedure that's readily available.

Soybean, The reason you find this strange or even more manual is because I didn't mention why I want to use a script. I didn't think I needed to. If you were to do this once in a while, then yes, it's better AND easier to do it by changing the properties. But if you are doing it frequently when supporting a lot of users on a regular basis, then it might be easier to use a script that you can run on the remote computer and everything will be set without having to do anything manually or even having the user involved.


Sidewinder, Thanks so much for your script. I will play with it and see how I can work with it.

Spoiler, You are right about the group policy, but unfortunately it's not being done that way at my place. At least not yet. May be in future.