Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Differences between TCC and CMD with COPY /b

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

Code:
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.
 
The problem is it doing it the behavior seems to have been around for a while. Even if it's undocumented, these kinds of differences make it very difficult to use TCC as a proper replacement for CMD since things will arbitrarily fail.

For this specific build script, it isn't mine so I can't fix it. Instead, I need to make sure I run cmd first before running it just so I can build it without errors.
 
Why not just keep using CMD in the COMSPEC variable?

I don't see that you gain much by having TCC there instead. You can still use all TCC features and run scripts without it.
 
Why not just keep using CMD in the COMSPEC variable?

Yep, it makes things simpler. I stopped trying to get TCC to properly process CMD scripts a long time ago and just run .BAT/.CMD files in CMD. I use .BTM extension for ones that use TCC syntax/features.
 
Back
Top
[FOX] Ultimate Translator
Translate