I have a File_2 that contains lines as follow
A1,A2,A3,A4
B1,B2,B3,B4
In another File_1 I have multiple lines as follow:
X
Y
Z
What I Want is to have File_3 with all possible combinations:
A1;A2;X;A4
A1;A2;Y;A4
A1;A2;Z;A4
B1;B2;X;B4
B1;B2;Y;B4
B1;B2;Z;B4
I use a code that populate an array from File_1 then I try to combine it with File_2 to obtain the File_3:
SET /A i=0
FOR /F "tokens=1" %%a IN (File_1.txt) DO (
    SET /P Var[%i%]=%%a
    SET /A i=+1
)
SET /A Counter=0
FOR /F "delims=, tokens=1-7" %%a IN (File_2.txt) DO (
    IF %Counter% LEQ %i% (
        ECHO %%a;%%b;%%Var[i]%%;%%d;>>File_3.txt
        SET /A Counter=+1
    )
)
The second loop doesn't seem to work. How can I use my Array's values, knowing that my Array is not static?
%Counter%does not update, you need to apply delayed expansion, so use!Counter!. But why not usingfor /L %%I in (1,1,%Counter%) do call echo %%a;%%b;%%Var[%%I]%%;%%d>>File_3.txt?