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,019
88
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,161
140
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?