Jump to content

[Question] - Change My Documents Location


MAC-DUFF

Recommended Posts

Hi,

I want to move the own documents folder via script. I only found the registry entry to set the path but after that i have to restart the pc what i dont want.

now i am looking for something which does it like u do it by your own (right mouse click etc) or i change the reg file and and reload the settings for my documents

hope somebody can help me

Link to comment
Share on other sites


Try something like this:

;Change location of my documents

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]

"Personal" ="C:\\My Data"

"My Video" ="C:\\My Data\\My Video"

"My Music" ="C:\\My Data\\My Music"

"My Pictures"="C:\\My Data\\My Pictures"

"Favorites" ="C:\\My Data\\Favorites"

or if you use Active Directory it can be done with a policy.

Link to comment
Share on other sites

Hi,

of corse, I know these reg entry. but after i ve done this i have to restart the pc.

but when i do this change via right mouse click, properties, location it will change just in the moment. so i think any service well be restarted.

Now I am looking for a script which does this "restart"

Link to comment
Share on other sites

Here is a script that will reboot the computer for you

Const LogOff = 0,  Shutdown = 1, Reboot = 2,PowerOff = 8
Dim WMISrv, StrOS, ObjOS
'ForcedLogOff = 0 + 4,ForcedShutdown = 1 + 4, ForcedReboot = 2 + 4,ForcedPowerOff = 8 + 4
strComputer = "."
Set WMISrv = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & strComputer & "\root\cimv2")
Set ObjOS = WMISrv.ExecQuery("Select * from Win32_OperatingSystem")
For Each StrOS in ObjOS
StrOS.Win32Shutdown(Reboot)
Next

Link to comment
Share on other sites

hi,

i dont mean the reboot in that way. i mean the changes which comes through a reboot. well, when i change the location via mouse it doesnt need a reboot because the service which is responsible for this restarts or refresh

hobe u unterstand me

Link to comment
Share on other sites

ok, i ll try it :)

at the moment when the user clicks on "my documents" he comes to %userprofile%\my documents. but now i want put these folder to his user drive. well, i copy via batch all files to j (user drive) and change the registry. but when he doesnt make a reboot and clicks on my documents he wonders where are all his files because windows hasnt taken over already the new path and then he will call us, everbody will call us!

I know that there exist a gpo for it but we have still problems with it and so we want to solve it by ourself.

I hope u understand me ;)

Link to comment
Share on other sites

How about a script that kills explore then restart explorer. So it applies the changes.

strComputer = "."

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'explorer.exe'")

For Each objProcess in colProcessList

objProcess.Terminate()

Next

CreateObject("Wscript.Shell").Popup "Explorer.exe, will restart in 5 seconds", 5, "Re Start Explorer", 0 + 32

CreateObject("Wscript.Shell").Run("explorer.exe")

Post the reg changes you want and I will script it so it applies them and then run the above script.

Link to comment
Share on other sites

thx,

but i think bother u for free. I check my template and found out after i installed the template that the location is directly changed. well, it seems that it works perfect :)

now i only have to create a verification which checks if the path is already changed and then copy the old files.

but i thank u very much

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...