iggy
iggy

Reputation: 15

How to suppress user input for xcopy

I created a batch file that copies the file from one directory to other. Below is my command.

xcopy  /y /e /s /c help_vc8.txt ..\..\help_vc8.txt.

When I run the batch file it asks for user input in CMD and displays below message:

Does ..\..\help_vc8.txt 
specify a file name  or directory name on the target
(F = file, D = directory)?

Now user has to enter f or d. I do not want this message and user should not enter f or d. Everything should happen on its own. Please help me if I missed out any thing in the command.

Upvotes: 0

Views: 1319

Answers (2)

Jasen
Jasen

Reputation: 12392

You appear to be missing the name of the destination directory.

if it really is \help_vc8.txt write it as \help_vc8.txt\ with the trailing \ and then xcopy will know it's supposed to be a directory,

or maybe you want: xcopy /y /e /s /c help_vc8.txt ..\..\

Upvotes: 1

npocmaka
npocmaka

Reputation: 57242

echo f|xcopy /y /e /s /c help_vc8.txt ....\help_vc8.txt

try like this for file.

echo D|xcopy /y /e /s /c help_vc8.txt ....\help_vc8.txt

for directory.

Upvotes: 1

Related Questions