0

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.

Harry Johnston
  • 35,639
  • 6
  • 68
  • 158
iggy
  • 15
  • 2
  • Possible duplicate of http://stackoverflow.com/questions/3018289/xcopy-file-rename-suppress-does-xxx-specify-a-file-name-message – twasbrillig Dec 26 '14 at 08:50
  • 1
    If you don't rename the file you can omit the file name and specify only the target directory. – harper Dec 26 '14 at 09:05
  • I recommend that you avoid `xcopy`. Try either plain old `copy` or `robocopy` instead, depending on your needs. – Harry Johnston Dec 27 '14 at 02:22

2 Answers2

1
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.

npocmaka
  • 55,367
  • 18
  • 148
  • 187
1

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 ..\..\

Jasen
  • 11,837
  • 2
  • 30
  • 48
  • Thanks for response but in my case it is file and the solution you suggested works well wit the directory. But what needs to be done for files. – iggy Dec 26 '14 at 09:38
  • ah, I see what you mean now! – Jasen Dec 26 '14 at 09:47