Differences between TCC and CMD with COPY /b

Aug 21, 2014
I was trying to build the code to a 3rd party program. The program has a complicated build system that uses the COMSPEC environment variable to invoke different commands. As I use TCC as my primary command shell, the build tools automatically used it. I am using TCC 26.02.42 x64.

I was getting failures when using TCC that I do not get when using CMD.

I traced it down to behavior difference in the COPY command when +,, is appended to the file. At one point, this is executed:

COPY /b <file>+,, <file>

Where <file> is the same filename.

I did a quick test by creating a dummy file and it does indeed seem that the behavior is different.

On TCC, it returns:

[D:\Temp]copy /b out.txt+,, out.txt
0 files copied

Whereas on CMD, it treats it as "success":

D:\Temp>copy /b out.txt+,, out.txt
1 file(s) copied.

It's silly to copy a file onto itself, but as it's a third party code base, it wouldn't be easy to make changes to it. Is there any way to make TCC emulate the behavior of CMD?

Also, as a side note, it seems like your forums use CloudFlare now for some kind of security scanning and it is over-aggressive. If you include the letters DOT EXE (using the symbol instead of the word DOT -- e.g. CMD*EXE) it will block me from posting.
May 20, 2008
Syracuse, NY, USA
About COPY, Microsoft has this to say (see here):

To assign the current time and date to a file without modifying the file, use the following syntax:

copy /b <source> +,,

Where the commas indicate that the destination parameter has been intentionally left out.

TCC honors that syntax.

v:\> ver
TCC 26.02.42
Microsoft Windows 10 Pro for Workstations
10.0.18363.1082 (1909)

v:\> copy /b count.txt+,,
2020-10-09 11:52:14.254  V:\count.txt

Whatever your build script is doing, it doesn't seem to be documented. Quite possibly, it's an error. I'd guess that the intention is simply to TOUCH the file (and the destination should have been left out). I wouldn't expect TCC to emulate it.