Differences between TCC and CMD with COPY /b

Aug 21, 2014
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.
 
May 20, 2008
11,388
99
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.

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.
 
Aug 21, 2014
18
1
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.
 
May 30, 2008
235
2
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.
 
May 26, 2008
537
4
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.
 
Similar threads
Thread starter Title Forum Replies Date
M Command line parsing differences between cmd.exe and TCC Support 6
epement differences in IDE/debugger between v12 and v14 Support 1
K CMD, TCC, VisualStudio 2017, VcVars* differences Support 1
D Tab completion differences with cmd.exe Support 3
R Difference between TCC and CMD: variable names with hyphens Support 4
R Lines between COMMENT & ENDCOMMENT not ignored Support 7
W pdir returns diff results between tcc and tcmd - one is an error msg Support 5
L WAD bad interaction between echox and command grouping Support 9
C Documentation difference between appdata and localappdata ? Support 6
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
D Fixed Change in behavior of variable expansion between 16 and 17 Support 3
Joe Caverly How to? Move Window Between Monitors Support 6
beerns different results between tcmd and cmd Support 2
C sharing global histories between different TCMD versions? Support 5
Jay Sage Inconsistency in Date Formats Between @DATE and @MAKEDATE Support 3
fpefpe Key Names to toggle between tab windows Support 1
Joe Caverly Move Buttons Between Tabbed Toolbars Support 2
D sync navigation between Folders List panel and the Tabs console Support 11
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
L FTYPE in TCC, less quirky than in cmd.exe Support 3
V Set path permanently from within TCC? Support 3
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
Joe Caverly tcc.exception.log Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
vefatica SCRIPT ... TCC disappears Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
Jesse Heines Access Denied errors in TCC 27 Support 9
fpefpe How to? tcc inifile (%_ininame) Support 3
M How to? Black TCC Prompt Support 2
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Jay Sage Extra TCC Tasks Support 6
vefatica Can I turn off the minimize to tray mechanism in TCC? Support 5
N Command execution slows down in TCC Prompt after a while Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
samintz How to? Is this doable in TCC? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
D TCC tab detaching & restarting Support 3
Ó Recent git output not shown on TCC Support 1
P Kill all other instances of tcc from a btm batch file Support 2

Similar threads