Announcement

Collapse
No announcement yet.

Trying to use Wildcards in my script is failing

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to use Wildcards in my script is failing

    Good afternoon everyone,
    I am having a bit of a problem. I am creating a simple script that will copy files from one of our servers to everyone's computer. The files need to go to a specific location within each user's profile. I tried using the default %userprofile% from within the script it failed. I searched this forum and found what I thought would work, but that too is failing. Can someone assist me with this script.

    Thanks

    Code:
    Const OverwriteExisting = True
    Dim FSO
    Dim WshS
    
    Set WshS = WScript.CreateObject("WScript.Shell")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    usrProfile = WshS.ExpandEnvironmentStrings("%UserProfile%")
    
    FSO.CopyFile "\\pluto\public\OutlookForms\*.*" , "usrProfile\application Data\Microsoft\Outlook\"

  • #2
    Re: Trying to use Wildcards in my script is failing

    The CopyFile method
    FSO.CopyFile "sourcefile(s)" , "destination\", OverwriteExisting

    where,
    - the Overwrite parameter (TRUE or FALSE) is optional
    - If destination is a folder it is best to put a trailing backslash after the foldername.


    In your script 'usrProfile' is a defined variable so the "destination\" parameter should be constructed like,

    Code:
    sDestination = usrProfile & "\application Data\Microsoft\Outlook\"
    
    FSO.CopyFile "\\pluto\public\OutlookForms\*.*" ,sDestination, OverwriteExisting
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: Trying to use Wildcards in my script is failing

      Thank you very much. that was exactly what i was looking for. thanks for the help

      app

      Comment

      Working...
      X