#124344 - 2004-08-03 05:14 PM
change location "my documents" dont work
|
expodium
Fresh Scripter
Registered: 2004-07-14
Posts: 35
|
hi,
i try to change the my document folder from the c drive to a f drive (f:\my documents) but its seems that he dont change the location.
my source( yeah i known but use the function for other purpose also ):
Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","My Pictures","f:\my documents\My Pictures","REG_SZ") Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Personal","f:\my documents","REG_SZ") Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","My Pictures","f:\my documents\My Pictures","REG_EXPAND_SZ") Change_Favorites("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Personal","f:\my documents","REG_EXPAND_SZ")
Function Change_Favorites($regKey, $subKey, $regValue, $regType) WriteValue($regkey, $subkey, $regValue, $regType) EndFunction
is there a other way to do?
i try also
WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","personal","f:\my documents","REG_SZ")
but when i go see to the property's of "my documents" its still in the old directory (c:\documents and settings\etc....)
who known how to do this?
many many thanks in advance
expodium
|
|
Top
|
|
|
|
#124345 - 2004-08-04 08:59 AM
Re: change location "my documents" dont work
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
Hmmm.... odd I just tried some code on a Non-Networked Windows XP w/SP1 and manually it does not seem to work as you say. If I redirect it via the GUI it works, but if I redirect it via the Registry as the KB articles say it does not change even if I reboot and set the HKLM key.
Getting late here so going to bed, perhaps someone else can assist you with this, as I won't be back on line maybe for another day.
Code:
Break On Dim $SO $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') Dim $UpdateMD,$ReadMD,$UpdateAD,$NewFolder $NewFolder='D:\My Documents' $UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Personal',$NewFolder,REG_SZ) $ReadMD=ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Personal') $UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','My Music',$ReadMD+'\My Music',REG_SZ) $UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','My Video',$ReadMD+'\My Video',REG_SZ) $UpdateMD=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','My Pictures',$ReadMD+'\My Pictures',REG_SZ) $UpdateAD=WriteValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths',@USERID,$NewFolder,REG_SZ)
Configuration of the My Documents Folder http://support.microsoft.com/?id=221837
User Data and Settings Management http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/management/user01.mspx
|
|
Top
|
|
|
|
#124350 - 2004-08-05 11:56 AM
Re: change location "my documents" dont work
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
You're correct Lonkero, I was modifying those keys (but did not post that code) but I was also modifying all the other keys at the same time which apparently was causing some issue preventing it from working. Trimming down the code to only modify the User Shell Folders keys now appears to work fine.
You MUST restart though for the change to take affect
Code:
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
Dim $UpdateMD,$ReadMD,$Key,$NewFolder
$NewFolder = 'D:\My Documents'
$Key = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders'
$UpdateMD = WriteValue($Key,'Personal',$NewFolder,REG_EXPAND_SZ)
$ReadMD = ReadValue($Key,'Personal')
$UpdateMD = WriteValue($Key,'My Pictures',$ReadMD+'\My Pictures',REG_EXPAND_SZ)
$UpdateMD = WriteValue($Key,'My Music',$ReadMD+'\My Music',REG_EXPAND_SZ)
$UpdateMD = WriteValue($Key,'My Videos',$ReadMD+'\My Videos',REG_EXPAND_SZ)
|
|
Top
|
|
|
|
#124351 - 2004-08-05 02:46 PM
Re: change location "my documents" dont work
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
However, if memory serves, you can do the same thing in GPO and is on the fly.
Kent
|
|
Top
|
|
|
|
#124353 - 2004-08-05 02:53 PM
Re: change location "my documents" dont work
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
True.. Just the restart is kinda kludgy (IMHO). I know it would be the only way to get the reg to work.
Kent
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1077 anonymous users online.
|
|
|