Batch file copying with wildcard

20 pts.
Tags:
Batch files
Command line
I am trying to write a batch file that will copy one file to several desktops in a directory. I've got this so far-
xcopy c:windowsoutput.txt U:UsersWILDCARDDesktop
In the wildcard section, we have usernames that are first initial last name and four digits. I would like to be able to just list the name and not the numbers, such as:
xcopy c:windowsoutput.txt U:UsersJSmith5624Desktop
So it will copy to U:UsersJSmith5624Desktop but I would like to not have to know the numbers, but instead use a wildcard, so if the directory contains "JSmith" it copies to that one. If I use a % , such as JSmith%, it makes a new directory- U:UsersJSmithDesktop instead of copying the file to U:UsersJsmith5624Desktop How can I use wildcards or maybe do an If/Then scenario, like IF directory contains "jsmith" THEN copy the file.
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: