Works with CMD.EXE, no output with TCC.EXE

The following .CMD works properly when run from CMD.EXE, and output is displayed;
Code:
@setlocal
@echo off
ver
setlocal enabledelayedexpansion
for /f "tokens=*" %%A in ('type "owing.txt"') do (
  set /a N += 1
  set "Line!N!=%%A"
)

for /l %%i in (1 1 %N%) do echo !Line%%i!

endlocal

You can substitute "owing.txt" with a text file of your choosing.

When I run this from TCC, no output is displayed.

When I run this from CMDebug v22.00.42 x64 with Options -> CMD Syntax, it runs, but no output is displayed.

Joe
 
May 20, 2008
11,538
103
Syracuse, NY, USA
Quoting CMD's FOR /?:
Code:
FOR /L %variable IN (start,step,end) DO command [command-parameters]

That is, with commas. When I add commas (and enable !delayed! expansion) it works fine in TCC.
Code:
for /l %%i in (1,1,%N%) do echo !Line%%i!
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
Looks like this is another one of those "it's CMD compatible as long as you make it TCC compatible".

I think it's more "TCC is CMD compatible, but CMD isn't CMD compatible".

I am curious how you came up with that (invalid in everything) syntax - did you find it in a third-party batch file, or did you type random input until CMD didn't actually blow up?
 
Similar threads
Thread starter Title Forum Replies Date
noahcoad c:/hello.txt works in cmd.exe but not tcc.exe Support 1
C .bat files works in cmd.exe, not in TCMD Support 6
I findstr works in cmd but not in tcc Support 5
Joe Caverly Works in debugger, not from cmd line Support 1
Joe Caverly Clearing a section of the screen works in CMD, not in TC Support 2
T VIEW only works from command line Support 14
D Alias with setdos no longer works Support 21
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
Phileosophos Enumshares works sometimes Support 16
Dmitry L. Kobyakov WAD Start /pgm "name.htm" works improperly Support 4
M "less" program that works in TC 18 Support 12
Joe Caverly Echo message works without the space? Support 3
cxxl dir /s works in mysterious ways :( Support 4
J WAD setarray "/f" only works on first one Support 1
M Console-Mode (*.exe) works in TCC, not in TCMD Support 2
redwdc btm won't run in ver. 17 but works in ver. 16 Support 11
I How to? Bat Works but BTM Doesn't Support 6
vefatica Alias works differenltly v16 vs. v17 Support 13
C FFind /w works but FFind /= doesn't? Support 2
R Drag to BTM no longer works in Windows 8.1 Support 10
Frank @replace works case sensitive Support 5
D TPIPE works without being in path, but not V; aemail Support 8
K Ctrl-D alias no longer works Support 4
R %+ works differently after upgrade Support 3
L How to synthesize cmd.exe's DEL /Q Support 2
T WAD CMD incompatibility Support 14
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
L FTYPE in TCC, less quirky than in cmd.exe Support 3
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
T Date format date different from cmd 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
E TCC/CMD difference Support 5
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
D How to? Pass OpenHere Folder to CMD? Support 6
R Difference between TCC and CMD: variable names with hyphens Support 4
M WAD "Pictures" directory is empty in TCC but not in CMD or Explorer Support 4
rps Cmd history recall Support 4
rps Documentation TITLE cmd docs Support 0
Joe Caverly PUSHD with UNC path in CMD.EXE Support 2
W Starting program for word to pdf conversion (difference cmd and tcc) Support 13
Joe Caverly Using this CMD technique from TCC Support 17
W If command - different with CMD Support 6
I how to make TCC default/replace cmd.exe? Support 9
R FOR usage error from TCC but not from CMD Support 16
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 tcommand(cmd) Support 13

Similar threads