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:
[JobSet]
Codec=hevc
Video=E:\folder\B 1.265
VideoWidth=1920
VideoHeight=1080
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??
Answer
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"
No comments:
Post a Comment