Simple .bat question - dump contents of 2 dimensional array


Jul 13, 2009
TCC 13.03.37 x64 Windows 7 [Version 6.1.7601]

I haven't worked with a .bat/.cmd/.btm file in a long time...
I use the sift plugin to create an array:
>sift 10 largest biguns
10 largest files sifted into BIGUNS[10,3].
From the command line, this works as expected:
>do i = 0 to 3 (echo %BIGUNS[%i,0])
However, when I try to do the same thing in a batch file (where __rowCnt and __arrName are parameters to the batch file):
set __arrName=%1
set __rowCnt=%2
do i = 0 to %__rowCnt (echo %__arrName[%i,0])
>c:\bin\dumpArray.bat BIGUNS 3

Thanks for any help...

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
I don't see any straightforward way to do a delayed expansion of an array variable. Here's a nasty Rube Goldberg approach:

do i = 0 to %__rowCnt ( echo %@execstr[echo %%%__arrName[%i,0]] )

If you're also using my SafeChars plugin, you could also:

do i = 0 to %__rowCnt ( echo %@safeexp[%__arrName[%i,0]] )

Perhaps someone else can come up with something a little more elegant...?
May 20, 2008
Elkridge, MD, USA
AFAIK array names cannot be specified indirectly. Your two methods are as simple as possible. I had written an ARRAY2FILE batch program, and used the @EXECSTR approach. @SAFEEXP would have been safer, though...
Similar threads
Thread starter Title Forum Replies Date
samintz How to? TPIPE /simple=61 Support 6
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
H TPIPE /simple=4 Support 12
T How can I send a simple parameter to a script, in tc 25? Support 2
C No simple way to tell new Alerts Support 8
P Simple RegEx copy Support 9
C WAD tpipe /simple=28 Support 8
C tpipe /simple=28 error Support 5
P WAD TC x64 crasches with a simple dir command Support 18
M Maybe Maybe I'm being stupid (again), but a simple question... Support 4
M What am I doing wrong in this (very simple!) code? Support 3
M How to? A very simple question re. the current line number in a batch file... Support 2
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
M Simple question about "Function" command... Support 4
M A simple question related to the "dir" (and "pdir") commands... Support 5
P "Simple question" concerning insert/overstrike mode Support 17
D Some feedback on simple batch file Support 2
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
I BTM slower than BAT? Support 14
S incorrect message at start Cancel batch job 4START.bat ? (Y/N/A) : Support 1
S Debugger Bat file call history Support 9
E How to? use Executable Extensions: .bat and .cmd Support 8
P MS VS2013 vsdevcmd.bat fails to run with tcmd 17 x64 Support 10
I How to? Bat Works but BTM Doesn't Support 6
C Documentation .CMD .BAT .BTM Support 15
w_krieger WAD 4DOS and benny.bat Support 2
A Stupid, obvious question - launch a BAT with TC Support 10
Mordachai How to get a TC interface instead of a console for .btm, .bat, ? Support 10
A WAD BOM printed on command line from BAT file Support 5
C .bat files works in cmd.exe, not in TCMD Support 6
CWBillow TCC and CMD / BAT files Support 3
C .CMD .vs. .BAT Support 3
B Strange handling of a .BAT file Support 5
Roedy bat file properties Support 1
C forum Posting Question... Support 3
C question re: Move Support 3
S How to? Upgrade Question: What supporting documentation is required at time of purchase? Support 2
Peter Murschall Documentation Question to %@PSHELL Support 4
Fross Tab Question Support 6
Fross Quick Function Question Support 17
Dick Johnson Question about the Touch command Support 0
rps Documentation "Copy+Paste+run" question Support 2
vefatica SFTP question Support 17
vefatica Question about IPWorks Support 0
C How to? SHORTCUT question..... Support 6
vefatica TPIPE, crash and question Support 1

Similar threads