VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. 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,
    Quote Quote  
  2. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    I have never installed the CLI version of mediainfo. The basic version typically fulfils my requirements.


    But CLI versions typically have a switch such as /? that reveal all available options.


    Have you looked in to that ?
    Quote Quote  
  3. 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.
    Quote Quote  
  4. Originally Posted by DB83 View Post
    I have never installed the CLI version of mediainfo. The basic version typically fulfils my requirements.
    But CLI versions typically have a switch such as /? that reveal all available options.
    Have you looked in to that ?
    Yes, I looked at the Help but couldn't figure out an option that would just change 1 parameter.

    Originally Posted by jagabo View Post
    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.
    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.
    Quote Quote  
  5. Originally Posted by UserName351 View Post
    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"
    d = drive letter and colon
    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".
    Quote Quote  
  6. Originally Posted by jagabo View Post
    Originally Posted by UserName351 View Post
    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"
    d = drive letter and colon
    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"
    Not sure what difference it makes but I don't know much about batch files so I'll keep your version.

    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
    What I want:
    Code:
    General
    Unique ID                        : 111111111111
    Complete name               : file.mkv
    Format                           : Matroska
    Format version                : Version 4
    . etc
    . etc
    . etc
    And also if possible: (I'd have it on another script)
    Code:
    General
    Unique ID                        : 111111111111
    Complete name               : AnotherSufolder\file.mkv
    Format                           : Matroska
    Format version                : Version 4
    . etc
    . etc
    . etc
    Quote Quote  
  7. For the first:

    Code:
    %~d1
    cd "%~p1"
    "G:\Program Files\MediaInfoCLI\MediaInfo.exe" --LogFile="%~n1.nfo" "%~nx1"
    The second is more difficult because you have to split the path just before the last folder name. So with:

    Code:
    \Folder\Subfolder\AnotherSufolder\file.mkv
    you need to split it into PATHPART1
    Code:
    \Folder\Subfolder\
    and PATHPART2
    Code:
    AnotherSufolder\
    Then you need to CD to the first part of the path, then call MediaInfoCLI with the second
    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
    I don't know how to do the path splitting at the command line but I believe it can be done.
    Quote Quote  
  8. Originally Posted by jagabo View Post
    I don't know how to do the path splitting at the command line but I believe it can be done.
    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
    Basically I save the current folder's name, go back up 1 folder with cd.. then use the relative path from there
    If anyone has a better way to do it, I'll take it, but this seems to work as intended
    Quote Quote  
  9. Originally Posted by UserName351 View Post
    I save the current folder's name, go back up 1 folder with cd.. then use the relative path from there
    Nice trick!
    Quote Quote  
  10. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    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
    Cheers.
    Quote Quote  
  11. Originally Posted by pcspeak View Post
    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
    Cheers.
    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
    Quote Quote  
  12. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Aha! Glad I helped (a little. )

    Cheers.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!