[windows2000] Re: Scripting question

  • From: "Braebaum, Neil" <Neil.Braebaum@xxxxxxxxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Tue, 6 Jan 2004 10:22:30 -0000

> From: "Puetz, Christoph" <christoph.puetz@xxxxxxxxxxx>
> Subject: [windows2000] Scripting question
> Date: Mon, 5 Jan 2004 12:38:18 -0700 
> 
> Anyone know how I need to specify the path to the local "My 
> documents" folder on a machine for a vbs script?
>  
> I am using this script to syncronize two folders. Works fine 
> between two folders when I paths like C:\temp and C:\test. 
> But I seem to get it wrong specifying the path to 
>  
> c:\documents and settings\user id\my documents. (user id of 
> course should be the logged on user
>  
> Any idea how I can specify that path with the user id 
> retrieved automatically so that it runs on that local my 
> documents folder no matter which user is logged in?

In your vbs script, open HKCU, and read the value in
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders\Personal

This is a string value, and is a result of what
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell
Folders\Personal (type REG_EXPAND_SZ) expands to.

This will mean that you will get the correct My Documents path, even if
it's redirected.

As you are already using the filesystemobject, and as it's a string
value, you shouldn't have any problems using the WScript.Shell regread
method.

> I want to 
> allow certain users to manually syncronize the my documents 
> folder with a network share (once everything
> works)

Having said all that, why not redirect My Documents for these users?

Neil

> '
> Dim fso, stash1, stash2, stash3, path1, path2
> Set fso = CreateObject("Scripting.FileSystemObject")
> '
> '  stash1, stash2, and stash3 are the paths to where the 
> files are that need to be ' synchronized.  As computer or 
> folder names change, these variables should be ' updated to 
> reflect the correct information. ' 
> stash1="c:\docume~1\"%userprofile%"\mydocu~1"
> stash2="C:\\temp\testest"
> 'stash3="C:\temp3"
> '
> SynchroFiles stash1, stash2 
> 'SynchroFiles stash1, stash3
> SynchroFiles stash2, stash1
> 'SynchroFiles stash2, stash3
> 'SynchroFiles stash3, stash1
> 'SynchroFiles stash3, stash2
> WorkWithSubFolders stash1, stash2 
> 'WorkWithSubFolders stash1, stash3 
> WorkWithSubFolders stash2, stash1
> 'WorkWithSubFolders stash2, stash3
> 'WorkWithSubFolders stash3, stash1
> 'WorkWithSubFolders stash3, stash2
> '

***********************************************
This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has come to you in error, please 
notify the sender immediately and delete this 
e-mail from your system.
You must take no action based on this, nor must 
you copy or disclose it or any part of its contents 
to any person or organisation.
Statements and opinions contained in this email may 
not necessarily represent those of Littlewoods.
Please note that e-mail communications may be monitored.
The registered office of Littlewoods Limited and its
subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
Registered number of Littlewoods Limited is 262152.
************************************************

********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: