Trying to use Wildcards in my script is failing

Home Forums Scripting Windows Script Host Trying to use Wildcards in my script is failing

This topic contains 2 replies, has 2 voices, and was last updated by Avatar apperrault 9 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Avatar

    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.


    Const OverwriteExisting = True
    Dim FSO
    Dim WshS

    Set WshS = WScript.CreateObject(“WScript.Shell”)
    Set FSO = CreateObject(“Scripting.FileSystemObject”)
    usrProfile = WshS.ExpandEnvironmentStrings(“%UserProfile%”)

    FSO.CopyFile “\plutopublicOutlookForms*.*” , “usrProfileapplication DataMicrosoftOutlook”


    Re: Trying to use Wildcards in my script is failing

    The CopyFile method
    FSO.CopyFile “sourcefile(s)” , “destination”, OverwriteExisting

    – 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,

    [COLOR=”DarkSlateGray”]sDestination = [/COLOR][B]usrProfile & “application DataMicrosoftOutlook”[/B]

    [COLOR=”DarkSlateGray”]FSO.CopyFile “\plutopublicOutlookForms*.*” ,[/COLOR][B]sDestination[/B][COLOR=”darkslategray”], OverwriteExisting[/COLOR][/CODE]

    Rems[CODE]sDestination = usrProfile & “application DataMicrosoftOutlook”

    FSO.CopyFile “\plutopublicOutlookForms*.*” ,sDestination, OverwriteExisting[/CODE]



    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


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Register for this Petri Webinar!

Want to Make Your Backup Storage Unlimited & Ready for the Cloud? – Free Thurrott Premium Account with Webinar Registration!

Tuesday, August 27, 2019 @ 1:00 pm EDT

A Scale-Out Backup storage infrastructure is a must-have technology for your backups. In this webinar, join expert Rick Vanover for a look on what real-world problems are solved by the Scale-Out Backup Repository.

Register Now

Sponsored By