Subtitles – Batch merge/mux .srt with .mkv files

I have a folder with:

  • TVShow – Episode 01.mkv
  • TVShow – Episode 01.srt
  • TVShow – Episode 02.mkv
  • TVShow – Episode 02.srt
  • TVShow – Episode 03.mkv
  • TVShow – Episode 03.srt

and so on…

I already know that I can do this with MKVMerge one by one. This would take a considerable amount of time so… I want to make a batch script that can do this for all the files in the folder with MKVToolNix, mkvmerge or similar.

I also need the batch script to be relative so that I can apply the script at a later use when the file names are different.The file name might not allways be “TVShow” but e.g “Second TV Show”.

1.I want to mux the external subtitle file (srt) into the respective movie file (mkv).

2.I also want to make the subtitle the default and forced subtitle of the respective movie file.

How can I make a batch script like this? I have some knowledge of batch scripting and I have googled this for a couple of hours without finding any useful info.

I started out with this but it does not work and also it does not set the subtitles to default or forced:

"B:OneDrivePortable applicationsmkvtoolnixmkvmerge.exe" "FOR %%A IN (*.mkv) DO mkvmerge -o "remux-%%~nA.mkv" "%%~A" "%%~dpnA.srt"

Solution:

for %%A IN (*.mkv) do ("B:OneDrivePortable applicationsmkvtoolnixmkvmerge.exe" -o "remux-%%~nxA" "%%~A" "%%~nA.srt"echo  Replace this Line with your othr commands!)

And see mkvpropedit — Modify properties of existing Matroska and Change Default Language/Subtitles in MKV Files