I m having issues in passing parameters to a batch file.A parameter file will have n number of lines and i want to execute the bacth to read the first line,take that as a parameter in .bat and execute.Read the next line take it as second parameter execute again.Likewise it should execute n number of times if it finds n number of lines in text file.(For example if the text file have 100 lines the loop execution in .bat should continue for 100 times). I have script like,
@echo off
setlocal enabledelayedexpansion
set file1=D:\Batch\parm.txt
set /a cnt=0
for /f "tokens=*" %%a in (%file1%) do (
set %file1% =%%a
echo !%file1%!
)
FOR /F "tokens=1 delims=|" %%G IN (%file1%) DO set a1=%%G
FOR /F "tokens=2 delims=|" %%K IN (%file1%) DO set a2=%%K
FOR /F "tokens=3 delims=|" %%I IN (%file1%) DO set a3=%%I
echo parameter file found
echo reading parameters to pass through
echo (%a1%,%a2%,%a3%)>>D:\Batch\output.txt
goto break
:break
set /a cnt+=1
exit /b
my parameter file has input as
"India"|"Australia"|"Africa"
"I1"|"A1"|"A11"
"I2"|"A2"|"A12"
my output should be:
parameter file found
reading parameters to pass through
"India","Australia","Africa"
parameter file found
reading parameters to pass through
"I1","A1","A11"
parameter file found
reading parameters to pass through
"I2","A2","A12"
i m currently getting only last parameter as output.Please help me to correct the script.