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.

1
  • How big is your array? Are you sure, there is an !array[%next%]!? Commented Oct 7, 2014 at 15:16

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.