1

I have written a batch file and tried to print array value inside loop. But the value is not echo. i have tried as

    @echo off
setlocal EnableDelayedExpansion
REM value in allargu -count 100 -delay 100
REM I want a count value 100 in variable
set "allargu="
set n=0
for %%a in (%*) do (
   set /A n+=1
   set "allargu[!n!]=%%~a"
   pause
)

REM For example, to process the filenames:
set /a iter=1
for /L %%i in (1,1,%n%) do (
   echo %%i- !allargu[%%i]!
   set /a iter=%%i
   set eachelement=!allargu[%%i]!
   if "!eachelement!" EQU "-count" (
        set /a iter+=1
    REM here I want to print 100 if count found 
        echo %allargu[!iter!]%
)
)

Thanks,

CrazyCoder
  • 772
  • 5
  • 11
  • 31
  • I followed that but I didnot got any answer for my question. I need to print array[iter] . – CrazyCoder Feb 07 '17 at 11:11
  • 2
    It should be `call echo %%allargu[!iter!]%%` or `for %%i in (!iter!) do echo !allargu[%%i]!`. See [this answer](http://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-script/10167990#10167990). – Aacini Feb 07 '17 at 13:15

0 Answers0