Scripting to move My documents

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

Is it possible to move My documents to a different location throug scripting?
Group Policy is not possible since my computer is not part of a domain.
 
Petsen said:
Hi.

Is it possible to move My documents to a different location throug scripting?
Group Policy is not possible since my computer is not part of a domain.
Hi,

For a standalone computer, a registry edit is one way to do it:

The "My Documents" path is in the Personal value under the keys

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

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

(both should be updated)


Here is a VBScript that redirects the pointer to "My Documents" (you need a
logoff/logon to see the change):

"Personal" is the value that is changed (it is placed under two different
registry keys).

'--------------------8<----------------------

' Change to correct path here
sMyDocPath = "U:\"

Set oShell = CreateObject("WScript.Shell")

oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\" _
& "Explorer\Shell Folders\Personal", sMyDocPath, "REG_SZ"

oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\" _
& "Explorer\User Shell Folders\Personal", sMyDocPath, "REG_EXPAND_SZ"

'--------------------8<----------------------
 
Back
Top