Nested For Loop in Batch -
Ive looks at several threads and can not solve my problem.
I would like to use two lists to create an output. Set
Client_ID = BJCH, BORG, FGMS, SVIN, JEFF, NWIL Runs = 1,2,9,10,12, 20% for %% (% Client_ID%) In (%% for %% (% partNEW)% (echo %% A %% B)) But the output I get is:
BJCH 1 BJCH 2 BJCH 9 BJCH 10 BJCH 12 BJCH 20 BORG 1 BORG 2 BORG 9 BORG 10 BORG 12 BORG 20 FGMS 1 FGMS 2 FGMS 9 etc .. What do I need
BJCH 1 Borg 2 FGMS 9 SVIN 10 JEFF 12 NWIL 20 Any ideas What am i doing wrong Any help is greatly appreciated.
Your two lists are different : if you have a To create a nest, you are multiplied by list of both processed for the same on There is no way to do this, unless you change the lists into two and then process the same for both , that is, the elements of two arrays with the same index P Action. For example: setlocal EnableDelayedExpension set client_id [1] = BJCH set Client_ID [2] = borg etc ... not set [1] = 1 set not run [2] = 2 etc. . / L %% i (1,1,6) for echo! Client_id [%% i]! ! PartNo [%% i]! You can also simulate the previous processing ("Two Elements with the same Index") in this way:
@echo Close Settlelock EnableDelayedExpension Set Client_ID = BJCH, BORG, FGMS, SVIN, JEFF, NYIAL, Part no no = 1,2,9,10,12,20 sets I = 0 for %% (% client_id%) (set / a i + = 1, j = 0%% in b (% no part%) (Set / AJ + = 1 if! I! Equ! J! Echo %% A %% B)) Edit : Output An example was added BJCH 1 Borg 2 FGMS 9 SVIN 10 JEFF 12 NWIL 20
Comments
Post a Comment