XCOPY parameter

I'm using the following batch script to copy a file off the server to my C drive.

net use z: \\nnsql\application /user:server\username password
set tdate=%DATE:~4,2%%DATE:~7,2%
XCOPY  Z:\testcopy_cmd.txt C:\Nnsqlbck\testcopy_cmd_%tdate%.txt /c /i
When I execute the above script file it prompts me for following. see below.
C:\My Documents>XCOPY  Z:\testcopy_cmd.txt C:\Nnsqlbck\testcopy_cmd_1123.txt /c /i
Does C:\Nnsqlbck\testcopy_cmd_1123.txt specify a file name
or directory name on the target
(F = file, D = directory)?

Is there a  parameter (i.e. /c../i...etc) that I can use to eliminate the above prompt so it can be copied automatically.  When I type the letter F, it copies the file.
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.

  per the MS help file,
/i : If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.

buy why not just use copy?  The normal copy command should work for you.


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
NBillyAuthor Commented:
I'll try your suggestion.  Thanks.
Julian HansenCommented:
Another way is to do pipe F to the command

echo F | xcopy Z:\testcopy_cmd.txt C:\Nnsqlbck\testcopy_cmd_%tdate%.txt /c /i /y

Depending on whether or not you want to overwrite an existing file you might want to add the /y paramter.

Try this:

echo f | XCOPY  Z:\testcopy_cmd.txt C:\Nnsqlbck\testcopy_cmd_%tdate%.txt /c
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

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.