Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
MAC-DUFF

[Question] - Change My Documents Location

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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"

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

Could you describe another way what you're trying to do? I'm a little confused on what you mean about a reboot.

Share this post


Link to post
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 ;)

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Send the location and I will make a script that checks the new location then copies, it not a problem

as I do not mind doing things like this.

Share this post


Link to post
Share on other sites

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 by what3v3r

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...