TCC/CMD difference

Jun 2, 2008
38
0
Denmark
Hi

I have discovered this difference while running the flutter.bat file provided by Google:
Code:
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1

In CMD, if the first command succeeds, nothing happens. If it fails, a message is shown and the script is terminated. In TCC, if the first command succeeds, no message is shown but the script is still terminated. So it seems that CMD and TCC do not quite agree on operator precedence here.

A well-placed set of parentheses solves this:
Code:
REM Test if Git is available on the Host
where /q git || (ECHO Error: Unable to find git in your PATH. && EXIT /B 1)
but this correction will have to be made every time Google updates this file.

- Ebbe
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
You might try the Duplicate Bugs option:

Duplicate-bugs.png
 
Jun 2, 2008
38
0
Denmark
Bump!

I ran into this bug again yesterday. And since all interaction with flutter goes through the flutter.bat file, this is really annoying.
 

rconn

Administrator
Staff member
May 14, 2008
12,365
150
I have discovered this difference while running the flutter.bat file provided by Google:
Code:
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1

That line isn't correct in either CMD or TCC. The && should be a single & - an ECHO will always return a 0, so the && is pointless. The only reason to use && is if you wanted to do a conditional operation here -- which you don't.

In CMD, there's a bug where it throws away the entire command line following a failed ||. I chose not to emulate this bug because (1) it's dumb, and (2) it would break existing TCC functionality.
 
Oct 29, 2008
88
0
You should submit a pull request to change it to:
Code:
where /q git || (ECHO Error: Unable to find git in your PATH. & EXIT /B 1)
which is correct for CMD.‍EXE as well as TCC.‍EXE. the fact that paren-less it does different things with & vs && means that it works at all is a bug.
 
Similar threads
Thread starter Title Forum Replies Date
R Difference between TCC and CMD: variable names with hyphens Support 4
W Starting program for word to pdf conversion (difference cmd and tcc) Support 13
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
L FTYPE in TCC, less quirky than in cmd.exe Support 3
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
M WAD "Pictures" directory is empty in TCC but not in CMD or Explorer Support 4
Joe Caverly Using this CMD technique from TCC Support 17
I how to make TCC default/replace cmd.exe? Support 9
R FOR usage error from TCC but not from CMD Support 16
I findstr works in cmd but not in tcc Support 5
D Pasting Unicode data has different behavior on TCC and CMD Support 2
M Command line parsing differences between cmd.exe and TCC Support 6
Joe Caverly Works with CMD.EXE, no output with TCC.EXE Support 7
K CMD, TCC, VisualStudio 2017, VcVars* differences Support 1
D Does TCC improve CMD's implementation of ECHO? Support 6
P Labels in batch files: TCC vs CMD.exe Support 9
C Nested IF syntax — TCC behaving differently to CMD Support 12
P Fixed Rexx .cmd files no longer work in TCC 20 Support 3
TT's Help! Uninstalling TCC did not restore cmd.exe as Win10 default batch file processor. Support 4
vefatica START, CMD vs. TCC Support 0
jogi Problem with FOR statement in TCC but not M$ CMD Support 1
vefatica SET /A "var%=N", TCC vs. CMD Support 0
noahcoad WAD cmd.exe under tcc doesn't find apps Support 4
tmaynard WAD Leiningen broken with TCC (but OK with CMD) Support 12
W /g option (%) on MOVE cmd appears broken TCC 14.03.57 x64 Support 8
B TCC 14.02.37 CMD Compatibility Loss? Support 4
noahcoad c:/hello.txt works in cmd.exe but not tcc.exe Support 1
noahcoad Fixed tcc /k not emulating cmd.exe w double quotes Support 1
Stefano Piccardi 13.0.31 2 MKLINK TCC vs CMD issues Support 2
daniel347x Different results with TCC than with cmd.exe Support 2
CWBillow TCC and CMD / BAT files Support 3
B %ProgramFiles(x86)% returns different values in TCC and CMD Support 3
D Peculiar symptoms w/ 4NT, TCC/LE vis a vis CMD.EXE Support 11
J Happy CMD/TCC incompatibility Support 0
vefatica TCC startup: /IP not honored after /K Support 1
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
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
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

Similar threads