I have a .ini file called job1.ini and this .ini contains information which I need to work with by injecting it on a specific spot in my batch script.

batch script is in the same folder as my .ini file

content of job1.ini:



Video=E:\folder\B 1.265



my script:

"C:\Temp\mkvmerge.exe" -o "E:\done.mkv" --title "B 1" "here_I_need_that_path_from_ini" "C:\Temp\audio.flac"

also I found this:

for /f "tokens=2 delims==" %%a in ('findstr Video job1.ini') do set Video=%%a

how could I combine these 3 pieces, so my script would work??


Your line:

for /f "tokens=2 delims==" %%a in ('findstr Video job1.ini') do set Video=%%a

can't work because findstr will also match the Videoheight/VideoWidth entries and have the resulting environment variable Video=1080

Try this (untested):

@Echo off&SetLocal EnableExtensions EnableDelayedExpansion
Set "Video="
for /f "delims=" %%a in ('findstr /i "^Video=" job1.ini') do set "%%a"
if defined Video "C:\Temp\mkvmerge.exe" -o "E:\done.mkv" --title "B 1" "%Video%" "C:\Temp\audio.flac"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.