I`m editing a bunch of files with mkvmerge and I'm doing this:
Video from original-001.mkv
mux with audio from audio-001.mkv
and add subtitle from sub-001.mkv
.
I'm creating a bunch of .bat scripts and using notapad++ find and replace function to do this:
find 001 and replace for 002, save as 002.bat and move on.
Basically, there will always be a base file named 001.bat
What would be really great is this Notepad++ portion could be automated. Find all strings "001", replace with "002", save as 002.bat Find "002", replace with "003", save as 003.bat.
Up to 300.
And finally what I do is another script: Call 001.bat Call 002.bat and so on. If I file doesn't exist there's no problem.
Is this possible using batch script on windows?
EDIT to add code as the way I'm going now: Example of 001.bat
"C:/Program Files/MKVToolNix\mkvmerge.exe" --ui-language en --output ^"F:\original\original-001 ^(1^).mkv^" --language 0:eng --default-track 0:yes --language 1:eng --default-track 1:yes ^"^(^" ^"F:\original\original-001.mkv^" ^"^)^" --no-video --language 1:por ^"^(^" ^"F:\BR001.mp4^" ^"^)^" --track-order 0:0,0:1,1:1
And I have this (but it's powershell)
powershell -Command "(gc 001.bat) -replace '001', '002' | Out-File 002.bat"
powershell -Command "(gc 002.bat) -replace '002', '003' | Out-File 003.bat"
powershell -Command "(gc 003.bat) -replace '003', '004' | Out-File 004.bat"
powershell -Command "(gc 004.bat) -replace '004', '005' | Out-File 005.bat"
powershell -Command "(gc 005.bat) -replace '005', '006' | Out-File 006.bat"
and so on
Finally I use this:
call 001.bat
call 002.bat
call 003.bat
call 004.bat
call 005.bat
call 006.bat
and so on
But I did it all by hand, so a automated way would be amazing for all outputs of mkvtoolnix because I can use advanced renamer to change all episodes to 001, 002.. and such and filebot later to have the correct season and episode list.
I doubt, generating 300 nearly identical batchfiles is a good idea. Use just one and loop over your numbers:
@echo off
setlocal
for /l %%i in (1,1,300) do call :processFile %%i
goto :eof
:processFile
set "number=000%1"
set "number=%number:~-3%"
echo %number%: original-%number%.mkv audio-%number%.mkv sub-%number%.mkv
REM insert your mux command here