Re: Copy File to user's profile

Tech-Archive recommends: Fix windows errors by optimizing your registry




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!!

.



Relevant Pages

  • RE: Browser lost its memory
    ... and on the Folder Options Click on View Tab. ... Remember each folder's view settings. ... History settings for keeping the history is set say for 30 days (you can make ... Temorary Internet Files ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Encryption and File settings and transfer wizard
    ... Subject: RE: Encryption and 'File settings and transfer wizard' ... After I did the restore, ... looked for the .pst files and the folder was empty. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Won,t Update
    ... I couldn,t rename the software distribution folder. ... Clearing Temporary Internet files, cookies and history in Internet Explorer ... Please note that Security settings in Internet Explorer must be set to Medium or ...
    (microsoft.public.windowsupdate)
  • Re: Quick Launch sort
    ... Windows 2000 has the best explanations. ... This will reset many things like saved folder settings. ... The changes you make to a folder's view is automatically saved when you close the folder. ... BOOL fShowAllObjects:1; ...
    (microsoft.public.windowsxp.general)
  • Re: Installer folders & best practices
    ... I have a list of developer assemblies which use a plugin design. ... These plugin settings are ... They are recommended to be placed into Application Folder. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework)