If the file name (%F) starts with a "-" character, the file is not found by ffprobe.exe (the file name from the next character after "-" is passed to ffprobe).
How to save this correctly?
for /f %%i in ('ffprobe -v error -select_streams v:0 -show_entries stream^=height -of csv^=s^=x:p^=0 "%%F"') do set hgt=%%i
I expected the full file name to be passed to ffprobe.exe, e.g. "- 7.06.2022.mpg"
1 Answer 1
Use the -- flag at the end of the command before the filename to indicate to ffprobe that there are no more flags expected and that any additional leading dashes are part of the filename.
for /f %%i in ('ffprobe -v error -select_streams v:0 -show_entries stream^=height -of csv^=s^=x:p^=0 -- "%%F"') do set hgt=%%i
answered Aug 8, 2024 at 20:20
SomethingDark
14.5k5 gold badges57 silver badges63 bronze badges
Sign up to request clarification or add additional context in comments.
5 Comments
rgr
Thanks! I had a similar problem with ffmpeg -- this worked as well.
SomethingDark
It's a common flag for most (if not all) applications that have a Linux version.
SomethingDark
Also, if this solved your problem, please click the checkmark next to my answer to mark it as the solution.
rgr
Done. I'm wondering -- why isn't the file name in quotes sufficient in this case?
SomethingDark
You'd have to check the source code. Presumably the part of the code that processes arguments allows for the entire argument to be in quotes as well.
Explore related questions
See similar questions with these tags.