Hello,
I'm using the MediaInfo CLI to get an NFO.
What should I do to modify only 1 parameter in the default output? I just want the file name in General to be only the file name and extension, not the path.
Right now I'm doing this in cmd, executed in the MediaInfo CLI folder:
MediaInfo.exe --LogFile="FullPath\FileName.nfo" "FullPath\FileName.mkv"
The NFO file I get is exactly what I want except for the FileName part, is there an option in the cmd to get the same output only changing the FileName?
Or do I need to make a custom output file? If thats the case, where could I find the default output file?
Additional, how would I make it so that FileName becomes "Folder\FileName"? Folder being only the folder containing the file, not the path.
Thx in advance for any help,
+ Reply to Thread
Results 1 to 12 of 12
-
-
I don't understand the question. Just leave out the path part of the filename. The logfile will be written to the CWD. Maybe you should spell out exactly what your goal is.
-
Yes, I looked at the Help but couldn't figure out an option that would just change 1 parameter.
Basically, I want a default MediaInfo NFO but just change file name to get include whole path (maybe just the folder containing the file).
Something that I didn't say, is that I'll call mediainfo within a batch file, my goal is to use that batch file to be able to right-click on my "file.mkv" select the Send To option in the contextual menu and chose my batch file. And since neitheir the batch file nor the mediainfo executable will be in the same folder as my "file.mkv" I'd need to give a full path. -
So you want the NFO file to be in the same folder as the MKV file? For a single MKF file:
Code:"X:\Path\To\MediaInfoCLI\MediaInfo.exe" --LogFile="%~dpn1.nfo" "%~dpnx1"
p = \path\to\file\
n = name of file (not including extension)
x = extension
1 = first argument on the command line
Put that in a batch file in your SendTo folder. Then you can right click an any media file and select Send To -> batchname.bat. If your media file is "X:\movies\My Movie.mkv" you will get "X:\movies\My Movie.nfo". -
Thank you, but that I could already do, I didn't use the same variables tho, mine was:
Code:"X:\Path\To\MediaInfoCLI\MediaInfo.exe" --LogFile="%~n1.nfo" "%~f1"
What I meant by I just want the file name, is inside the NFO file, in the General category, both your code and mine give full path. The only way I found in my tests when I was running the CLI throught the cmd and not the .bat script is that if my MKV file is in the mediainfo.exe's folder it would gibe me only the file name.
I don't know if i'm being clear enough, I tend to not express myself very well when asking for help... So here's what I mean:
Right now this is what I get:
Code:General Unique ID : 111111111111 Complete name : D:\Folder\Subfolder\AnotherSufolder\file.mkv Format : Matroska Format version : Version 4 . etc . etc . etc
Code:General Unique ID : 111111111111 Complete name : file.mkv Format : Matroska Format version : Version 4 . etc . etc . etc
Code:General Unique ID : 111111111111 Complete name : AnotherSufolder\file.mkv Format : Matroska Format version : Version 4 . etc . etc . etc
-
For the first:
Code:%~d1 cd "%~p1" "G:\Program Files\MediaInfoCLI\MediaInfo.exe" --LogFile="%~n1.nfo" "%~nx1"
Code:\Folder\Subfolder\AnotherSufolder\file.mkv
Code:\Folder\Subfolder\
Code:AnotherSufolder\
Code:REM Split full path into PATHPART1 and PATHPART2 here. %~d1 cd PATHPART1 "G:\Program Files\MediaInfoCLI\MediaInfo.exe" --LogFile=%PATHPART2%%~n1.nfo %PATHPART2%%~nx1
-
Thank you for your help, with a bit of googling I found this superuser.com question and managed to use what you gave me to make it so it gives me only the folder name too.
In case someone sees this post and wants my result, here it is:
Code:@echo off REM: Gives NFO file with LastFolder\FileName.mkv in General %~d1 cd "%~p1" for %%I in (.) do set CurrDirName=%%~nxI cd .. "C:\Program Files\MediaInfo_CLI_21.09_Windows_x64\MediaInfo.exe" --LogFile="%CurrDirName%\%~n1.nfo" "%CurrDirName%\%~nx1" echo Fin
If anyone has a better way to do it, I'll take it, but this seems to work as intended -
Hello everyone.
This will give you ONLY the filename.ext in a .nfo file, next to the video.
It will recurse into all sub directories.
We can add to the batch file to add more detail to the .nfo file.
Please change the path to MediaInfo.exe as needed.
Code:@echo off for /r %%a in ("*.mp4", "*.avi", "*.mkv") do call :process "%%a" Exit :process echo Creating a .nfo file for "%~1" "C:\Library\MediaInfoCLI\MediaInfo.exe" "--Inform=General;%%FileNameExtension%%" "%~1" > "%~dpn1.nfo" goto :eof
-
Hello,
You got it wrong, I didn't want just the FileName inside the nfo, I wanted to have just the file name without the path, and the rest of the nfo informations in general, video etc.
The code in the post above your does that.
However, I was thinking of making an script that would be able to make an nfo out of all the files inside a folder, and your code helped to do that, so thank you.
Here's what I did:
Code:@echo off for /r %%a in ("*.mp4", "*.avi", "*.mkv") do call :process "%%a" Exit :process %~d1 cd "%~p1" "C:\Program Files\MediaInfo_CLI_21.09_Windows_x64\MediaInfo.exe" --LogFile="%~dpn1.nfo" "%~nx1" goto :eof
Similar Threads
-
Xvid 1.3.5 (CLI)
By LigH.de in forum Video ConversionReplies: 5Last Post: 18th May 2021, 15:17 -
Get-MediaInfo - a complete PowerShell MediaInfo solution
By stax76 in forum ProgrammingReplies: 6Last Post: 31st Mar 2021, 05:41 -
Xvid 1.3.5 CLI issues
By Selur in forum Video ConversionReplies: 30Last Post: 12th Oct 2020, 01:25 -
mediainfo cli
By zerobyte01 in forum Newbie / General discussionsReplies: 4Last Post: 20th Jul 2018, 17:41 -
Mediainfo CLI to creat NFO
By WakaFlakaFlakes in forum Newbie / General discussionsReplies: 3Last Post: 12th May 2017, 10:17