Skip to content

Instantly share code, notes, and snippets.

@icecore2
Created August 11, 2018 14:00
Show Gist options
  • Save icecore2/b2c192882bccfa0faa940ee342db10e6 to your computer and use it in GitHub Desktop.
Save icecore2/b2c192882bccfa0faa940ee342db10e6 to your computer and use it in GitHub Desktop.
Media file extention convertion to MKV with MKVMerge
@echo off
set mkvmergepath=mkvmerge.exe path
set videofileformat=file extention
:: Files counter for convertion
echo.
echo =========== Counter to convertion ================
set filesCounter=0
for /r . %%A IN (*.%videofileformat%) do (
set /a filesCounter+=1
)
echo Found %filesCounter% files to convert with %videofileformat% extention.
pause
:: Removing question
:RemovingQuestion
echo.
set /p removingOld=Would you like to remove old files after converted[y/n]? :
if /I "%removingOld%" EQU "y" set removingOld=0:yes&call:WithRemoving
if /I "%removingOld%" EQU "n" set removingOld=1:yes&call:WithoutRemoving
echo you have entered something invalid&goto:RemovingQuestion
:: Without removing loop
:WithoutRemoving
echo.
for /r . %%A IN (*.%videofileformat%) do (
echo =========== Convertion proccess ================
"%mkvmergepath%" -o "%%~A.mkv" "%%~A"
)
:: With removing loop
:WithRemoving
echo.
for /r . %%A IN (*.%videofileformat%) do (
echo =========== Convertion proccess ================
"%mkvmergepath%" -o "%%~A.mkv" "%%~A"
::pause
echo =========== Removing old files ================
echo File name to remove:
del "%%~A"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment