mkvpropedit batch script

Discussion in 'Scripting' started by Duckz, Jun 9, 2021.

  1. Duckz

    Duckz MDL Junior Member

    Jan 6, 2010
    51
    10
    0
    Hi all, just trying to put together a drap&drop script to process the header information of a bunch of mkv video files using mkvpropedit; https://mkvtoolnix.download/doc/mkvpropedit.html. Seeing if the knowledgeable people around these parts would be able to help.

    Here is the current script:
    Code:
    echo off
    if [%1]==[] goto :eof
    :loop
    "C:\Program Files\MKVToolNix\mkvpropedit.exe" "%~1" --delete segment-uid --edit track:v1 --set flag-default=1 --set language="eng" --delete name --edit track:a1 --set flag-default=1 --set language="eng" --delete name --edit track:s1 --set flag-default=1 --set flag-forced=1 --set name="Foreign Only" --set language="eng" >nul
    echo "%~n1"
    echo Result %ERRORLEVEL%
    shift
    if not [%1]==[] goto loop
    :eof
    pause
    The script works how I would like it to, but right now, if I drop a file without a subtitle track (edit track:s1 and the flags thereafter pertain to the subtitle track), the script stops with an error code because the track isn't present.
    I'm wondering if it would be possible to look for the subtitle track, and if it isn't present, continue to finish the script.

    Very green with all this, and just piecing this together with limited knowledge.

    Thanks.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...