Windows Command line basics

I need a .cmd file to create a directory based on value supplied as arg 2 and copy all of the files from a directory whose name is partially suppllied by arg1

I want to be able to enter "test  1234 5678" and have a directory named 5678ver made and all of the files copied from 1234ver into it.

I cut/pasted what I have done thus far and for some reason it does not do the copy....the directory gets created OK but the files do not get copied....

echo on
if "%1"=="" goto badArgs
if "%2"=="" goto badArgs
mkdir %2%ver
copy "%1%ver\*.for %2%ver\*.*"  
goto exit

Echo "Old and new numbers required as start arguments"
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi smm57,

IMO there are two problems:

1. Instead of using '%1%' and '%2%' in the 'copy'-statement you should use '%1' and '%2'
2. With escaping the whole expression after 'copy' by "-s the whole expression is passed as one argument.

This should work - replace this line:

> copy "%1%ver\*.for %2%ver\*.*"  

with this one:

> copy "%1ver\*.for" "%2ver\*.*"

Hope that helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
smm57Author Commented:
Yes, that did it thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.