#1 16 Oct 2018 20:30

chrisjj
Member
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)?

v.

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

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

Offline

#2 16 Oct 2018 22:15

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 976
Website

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.

Offline

Board footer

Powered by FluxBB