У меня есть основной набор значений и подмножество к нему
Основной набор: Group1,Group2,Group3
Подмножество: Group1_Sub1,Group1_Sub2,Group2_Sub1,Group3_Sub1,Group3_Sub2
Group1 ->Group1_Sub1 and Group1_Sub2
Group2 ->Group2_Sub1
Group3 ->Group3_Sub1,Group3_Sub2
Для каждого основного списка я бы хотел выполнить цикл только по соответствующему списку подгрупп и отобразить вывод.
В настоящее время я использую код ниже
for %%s in (
Group1,Group2,Group3
) do (
echo set Main Group %%s >> Log.txt
for %%i in (
Group1_Sub1,Group1_Sub2,Group2_Sub1,Group3_Sub1,Group3_Sub2
) do (
echo Main Group is %%s and its sub group is %%i >>Log.txt
)
)
Приведенный выше код выдаст мне вывод:
set Main Group Group1
Main Grpup is Group1 and its sub group is Group1_Sub1
Main Grpup is Group1 and its sub group is Group1_Sub2
Main Grpup is Group1 and its sub group is Group2_Sub1
Main Grpup is Group1 and its sub group is Group3_Sub1
Main Grpup is Group1 and its sub group is Group3_Sub2
set Main Group Group2
Main Grpup is Group2 and its sub group is Group1_Sub1
Main Grpup is Group2 and its sub group is Group1_Sub2
Main Grpup is Group2 and its sub group is Group2_Sub1
Main Grpup is Group2 and its sub group is Group3_Sub1
Main Grpup is Group2 and its sub group is Group3_Sub2
set Main Group Group3
Main Grpup is Group3 and its sub group is Group1_Sub1
Main Grpup is Group3 and its sub group is Group1_Sub2
Main Grpup is Group3 and its sub group is Group2_Sub1
Main Grpup is Group3 and its sub group is Group3_Sub1
Main Grpup is Group3 and its sub group is Group3_Sub2
Я бы хотел ограничить их просмотр только соответствующим списком, как показано ниже
set Main Group Group1
Main Grpup is Group1 and its sub group is Group1_Sub1
Main Grpup is Group1 and its sub group is Group1_Sub2
set Main Group Group2
Main Grpup is Group2 and its sub group is Group2_Sub1
set Main Group Group3
Main Grpup is Group3 and its sub group is Group3_Sub1
Main Grpup is Group3 and its sub group is Group3_Sub2
Как мне этого добиться?