I need to run a process on many items and the process takes a configuration file as input. The configuration file needs to be changed for each item at three different lines (1,2,17) with different extensions. I can read the configuration file into batch script as a text file but it should be saved with *.cfg configuration so that it can be used. I have put together the following pseudo code with pointers where I would need help for making it functioning batch script.
set inputline=1
set outputline=2
set xmlline=17
set infile=config.txt
set items=list.txt
for /f "delims=" %%a in (%items%) do (
echo.%%a
set curr=1
for /f "delims=" %%b in (%infile%) do (
if !curr!==%inputline% [replace this line in infile with "a".ext1]
if !curr!==%outputline% [replace this line in infile with "a".ext2]
if !curr!==%xmlline% [replace this line in infile with "a".ext3]
)
set /b "curr = curr + 1"
[save "infile".cfg]
)
"call" proccess.exe -config.cfg
)
And the configuration file:
sample.264
sample.yuv
test_rec.yuv
1
1
0
2
500000
104000
73000
leakybucketparam.cfg
1
2
2
0
1
sample.xml
3