0

I have 2 string in windows batch file and I want the n element from the first list will be assign to the n element from the second list

I want:

1A
2B
3C

what I've done is this:

FOR %%A IN (1 2 3) DO FOR %%B IN (A B C) DO ECHO %%A=%%B

but this create

1A
1B
1C

2A
2B
2C
.
.
.

which is clearly not what i need... Thanks

1 Answer 1

2

as edit seems not to be posted, try this

setlocal enabledelayedexpansion
set /A COUNTER=1
FOR %%A IN (A B C) DO (
  ECHO %%A!COUNTER!
  set /A COUNTER+=1
)
endlocal
Sign up to request clarification or add additional context in comments.

2 Comments

question added in the post above
Deleted my post since this one is better. Thanks @elzooilogico for the edit though ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.