如何在批处理文件中打印数组值

时间:2017-02-07 10:59:14

标签: batch-file

我编写了一个批处理文件并尝试在循环内打印数组值。但价值不是回声。 我试过了

    @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!]%
)
)

谢谢,

0 个答案:

没有答案