I'm trying to learn how to use MediaInfo (CLI). In the process, I stumbled onto this thread that provided some promising value. MediaInfo CLI (Command Line Interface) Syntax Teaching Me Once & For All
However, when I try to script it in a batch file, MediaInfo will **NOT **process the mp4 file and read the data that I'm asking for.
If I Copy/**Paste **directly into the Command Prompt, it **WILL **return the values requested.
Has anyone else seen this before, or have any ideas what might be rendering the use of batch files with mediainfo useless?
Here's the code I'm running in both the batch file (FAILS) and directly in the Command Prompt (SUCCESS):
mediainfo --Output="General;File Name: %FileName%\r\nDuration: %Duration/String3%\r\nSize: %FileSize/String%" "D:\Movies\Saving Private Ryan (1998).mp4" >> D:\OutputTest.txt
My output when pasting/typing directly into Command Prompt:
File Name: Saving Private Ryan (1998)
Duration: 02:49:26.848
Size: 10.8 GiB
My output when running the exact same code in batch file:
File Name:
Duration:
Size:
Thanks,
Software: W10Pro v22H2 (up to date) MediaInfo CLI x64 v23.07 (latest version)
EDIT:
Hi Compo,
To answer your question: No, I failed to escape those %
characters in my batch script. I ran your example and the script ran without issue.
I corrected my script based on your suggestion from %
to %%
.
Final output for my test code is working:
mediainfo.exe --Output="General;File Name: %%FileName%%\r\nDuration: %%Duration/String3%%\r\nSize: %%FileSize/String%%" "D:\Movies\Saving Private Ryan (1998).mp4" >> "D:\OutputTest.txt"