Why does the command XCOPY in batch file ask for file or folder?

A seemingly undocumented trick is to put a * at the end of the destination – then xcopy will copy as a file, like so

xcopy c:\source\file.txt c:\destination\newfile.txt*

The echo f | xcopy ... trick does not work on localized versions of Windows, where the prompt is different.

Leave a Comment