#1 16 Oct 2018 20:30

Registered: 12 Oct 2018
Posts: 12

https://ss64.com/nt/xcopy.html feedback 2

When copying a single file with XCOPY, there is no option to indicate if the destination is a 
filename or a directory (with the filename defaulting to that of the source file).

seems not entirely true, e.g.

C:\temp>xcopy /L C:\Users\Chris\AppData\Local\Temp\src*.bat C:\Users\Chris\AppData\Local\Temp\dest.bat
Does C:\Users\Chris\AppData\Local\Temp\dest.bat specify a file name
or directory name on the target
(F = file, D = directory)?


C:\temp>xcopy /L /I C:\Users\Chris\AppData\Local\Temp\src*.bat C:\Users\Chris\AppData\Local\Temp\dest.bat
1 File(s)

Last edited by chrisjj (16 Oct 2018 20:30)


#2 16 Oct 2018 22:15

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,029

Re: https://ss64.com/nt/xcopy.html feedback 2

I dont know which version of XCOPY you are using but those commands don't work for me on Windows 10.

The /i option specifies to always treat the destination as a folder, when I use it along with a file destination, I still get the prompt just as if  /i wasnt specified at all.

Of course if I create a destination folder called dest.bat, then it runs without a prompt and copies the file to ..AppData\Local\Temp\dest.bat\src.bat
but that probably isnt what you wanted.

The only way I've found to force always copying a file without a prompt is to append a wildcard. But really you should just use Robocopy, it is vastly superior to XCOPY.


Board footer

Powered by FluxBB