0

i got a problem with my batch file that echo two array contents.

for /L %%i in (1,2,%n%) do (
    set /A next=%%i+1

    echo !array[%%i]!
    echo !array[%next%]!  //This doesn't work
)

Output:

_content_array
ECHO is off.

When i turn Echo on the Output is:

 _content_array
 ECHO is on.

_content_array is perfect, it works. But the 2nd call (!array[%next%]!) doesn't work, i think i just failed to call, i tried out some other calls but it never worked for me.

Thx for your time.

Sven Liebig
  • 828
  • 7
  • 18

1 Answers1

1
for /L %%i in (1,2,%n%) do (
    set /A next=%%i+1

    echo !array[%%i]!
    for %%n in (!next!) do echo !array[%%n]!
)

You may read full details about this solution at this post.

Community
  • 1
  • 1
Aacini
  • 65,180
  • 12
  • 72
  • 108