Re: Copy File to user's profile
- From: "Marty List" <usenet@xxxxxxxxxxxx>
- Date: Fri, 20 Apr 2007 20:12:22 -0600
VBScript won't automatically expand the %USERNAME% variable, that's a CMD.EXE/Command Prompt feature. You could use the ExpandEnvironmentStrings method:
http://msdn2.microsoft.com/en-us/library/dy8116cf.aspx
But the 'Documents and Settings' folder might be on D:\, so you should use %USERPROFILE%. But the user's Application Data folder could be redirected somewhere else, so even better would be %APPDATA%.
Another way would be to use WSH's SpecialFolders property:
Set objShell = WScript.CreateObject("WScript.Shell")
AppData = objShell.SpecialFolders("AppData")
objFSO.CopyFile "\\Server\Share\LinkConfig\Config.ini" , AppData & "\LinkConfig\", OverwriteExisting
"Michael Martis" <Michael Martis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:61290DBD-B995-4274-BF83-3D1893D6A486@xxxxxxxxxxxxxxxx
I need to copy a config file to each user's Documents and Setting/Local.
Settings. This is what I have so far,
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\Server\Share\LinkConfig\Config.ini" , "C:\Documents and
Settings\%USERNAME%\Application Data\LinkConfig\", OverwriteExisting
My main problem is getting the file to copy to the logged in user's profile.
Any help would be greatly appreciated!!
- Prev by Date: script to copy user profile!!
- Next by Date: Re: script to copy user profile!!
- Previous by thread: script to copy user profile!!
- Next by thread: create AD-PC-Account with given GUID per script
- Index(es):
Relevant Pages
|