You are not logged in.
Pages: 1
I'm trying to expand 2 variables at the same time. Is this possible? The issue I'm having is during the IF statement. Instead of echoing 1 and then 2, the script echos 1 and 1.
SETLOCAL ENABLEDELAYEDEXPANSION
SET i=0
SET ARR[%i%]=1
SET /A "i+=1"
SET ARR[%i%]=2
SET /A "i+=1"
SET ARR[%i%]=3
SET ARR
SET len=%i%
SET i=0
IF YO EQU YO (ECHO !ARR[%i%]!
SET /A "i+=1"
ECHO !ARR[%i%]!)
I did try variations of !ARR[!i!]!, ^!ARR[!i!]^!, !ARR[^!I^!]!, and ^!ARR[^!I^!]^! with undesirable results. Anyone can help? Thanks.
Offline
I suggest you to carefully read this answer.
Offline
I suggest you to carefully read this answer.
That was an interesting read and thank you for linking that article. I somewhat understand what the post talked about and was able to complete my script. Thanks Aacini.
SETLOCAL ENABLEDELAYEDEXPANSION
SET i=0
SET ARR[%i%]=1
SET /A "i+=1"
SET ARR[%i%]=2
SET /A "i+=1"
SET ARR[%i%]=3
SET ARR
SET len=%i%
SET i=0
IF YO EQU YO (ECHO !ARR[%i%]!
SET /A "i+=1"
call ECHO %%ARR[!i!]%%
SET /A "i+=1"
call ECHO %%ARR[!i!]%%)
Offline
May I ask you to upvote such S.O. answer? It just needs 4 upvotes more to accumulate 100!
Offline
May I ask you to upvote such S.O. answer? It just needs 4 upvotes more to accumulate 100!
3
Offline
Pages: 1