Welcome!

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

SignUp Now!

@TMP not returning contents

Aug
1,943
71
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  31.01.19 x64   Windows 10 [Version 10.0.19045.3930]
BuildNumber  Caption                   CSDVersion  OSArchitecture  Version
19045        Microsoft Windows 10 Pro              64-bit          10.0.19045

22H2

The following code populates TMP9:, but @TMP does not return all contents.

Would appreciate if others could duplicate this on their system,
and show me what I am not doing correctly.

Code:
@SETLOCAL
@ECHO OFF
REM Just to be sure, clear TMP9:
tmp /c tmp9:
REM Put some lines into TMP9:
Gosub Init > tmp9:
REM Show the contents of TMP
tmp
REM Pause to view above
pause
REM How many lines in tmp9:
echo @Lines: 0-%@lines[tmp9:]
REM Display the first three lines in tmp9:
echo %@tmp[0,9]
echo %@tmp[1,9]
echo %@tmp[2,9]
REM Only displays line 0
REM Lines 1 and 2 return ECHO OFF
ENDLOCAL
quit

:Init
text
1950/01/28
1956/01/28
1961/01/28
1967/01/28
1978/01/28
1984/01/28
1989/01/28
1995/01/28
2006/01/28
2012/01/28
2017/01/28
2023/01/28
endtext
Return

Thanks from Joe
 
A slightly different test but it looks like @TMP misbehaves as you mentioned.

Code:
v:\> echo foo^r^nbar^r^nfly > tmp9:

v:\> type tmp9:
foo
bar
fly

v:\> echo %@lines[tmp9:]
2

v:\> echo %@tmp[0,9]
foo

v:\> echo %@tmp[1,9]
ECHO is OFF

v:\> echo %@tmp[2,9]
ECHO is OFF
 
Quite possibly related:

Code:
v:\> type tmp9:
foo
bar
fly

v:\> echo %@line[tmp9:,0]
foo

v:\> echo %@line[tmp9:,1]
ECHO is OFF

v:\> echo %@line[tmp9:,2]
ECHO is OFF
 
Verified here as well. I think we have a bug. Has anyone ever really tried to use this? I for one didn't even know it existed.

On the other hand, this does work:

do x in @tmp9: (echo %x)
 

Similar threads

Back
Top