March 1, 200620 yr 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 documentshope somebody can help me
March 1, 200620 yr 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.
March 1, 200620 yr What can't be done? The reg hack or changing the location of My Documents? If you mean actually changing the location we've done it where I work. Am I reading something incorrectly?
March 1, 200620 yr Author 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"
March 1, 200620 yr Here is a script that will reboot the computer for youConst 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
March 1, 200620 yr Author 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 refreshhobe u unterstand me
March 1, 200620 yr I thought you ment reboot the system that what the script does, sorry I will slap my self 10 times with wet noodles, for missing what you ment.
March 1, 200620 yr Author I think the cause is my bad english. so, u dont have to punish yourself out of u like it But i ll would be glad about a solution
March 1, 200620 yr Could you describe another way what you're trying to do? I'm a little confused on what you mean about a reboot.
March 1, 200620 yr Author 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
March 1, 200620 yr 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()NextCreateObject("Wscript.Shell").Popup "Explorer.exe, will restart in 5 seconds", 5, "Re Start Explorer", 0 + 32CreateObject("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.
March 1, 200620 yr Author 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
March 1, 200620 yr Send the location and I will make a script that checks the new location then copies, it not a problemas I do not mind doing things like this.
March 1, 200620 yr how did you change the path now? or in other words, how did you achieve that the change was instantly applied without a reboot? Edited March 1, 200620 yr by what3v3r
Create an account or sign in to comment