MAC-DUFF Posted March 1, 2006 Posted March 1, 2006 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
exrcizn Posted March 1, 2006 Posted March 1, 2006 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.
exrcizn Posted March 1, 2006 Posted March 1, 2006 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?
MAC-DUFF Posted March 1, 2006 Author Posted March 1, 2006 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"
gunsmokingman Posted March 1, 2006 Posted March 1, 2006 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
MAC-DUFF Posted March 1, 2006 Author Posted March 1, 2006 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
gunsmokingman Posted March 1, 2006 Posted March 1, 2006 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.
MAC-DUFF Posted March 1, 2006 Author Posted March 1, 2006 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
exrcizn Posted March 1, 2006 Posted March 1, 2006 Could you describe another way what you're trying to do? I'm a little confused on what you mean about a reboot.
MAC-DUFF Posted March 1, 2006 Author Posted March 1, 2006 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
gunsmokingman Posted March 1, 2006 Posted March 1, 2006 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.
MAC-DUFF Posted March 1, 2006 Author Posted March 1, 2006 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
gunsmokingman Posted March 1, 2006 Posted March 1, 2006 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.
what3v3r Posted March 1, 2006 Posted March 1, 2006 (edited) 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, 2006 by what3v3r
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now