I'm looking for some command / script to scan my designated folder, merge the srt files (same name as video) with avi/mp4/mkv files to get mkv files, and then delete the original files (video AND subtitle).
Now I have this code (not mine, from some authors I combined):
@echo off for /R %%A IN (*.mkv *.avi *.mp4) do ( "C:\Program Files\MKVToolNix\mkvmerge.exe" -o "%%~nxA_CZ.mkv" "%%~A" "%%~nA.srt" if errorlevel 1 ( echo Warnings/errors generated during remuxing, original file not deleted ) else ( del /f "%%A" "%%~nA.srt" echo Successfully remuxed to "%%~dpna (No Subs)%%~xa", original file deleted ) echo. ) ) )
Which kind of works, but I have a few problems.
/R parameter isn't working, don't know why, but when I place it in a folder with subfolders it only scans the srt files in it and I get a "Can't open" error. (This error also appears for files in a single folder but in the end it does what I need.)
Any idea how to fix my problem?