NateMac00

mkv-batch-AudioReorder.bat

May 12th, 2026
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3.  
  4. set "SCRIPT_DIR=%~dp0"
  5. set "PS_SCRIPT=%SCRIPT_DIR%mkv-batch-reorder.ps1"
  6.  
  7. if not exist "%PS_SCRIPT%" (
  8. echo ERROR: mkv-batch-reorder.ps1 not found next to this batch file.
  9. echo Expected: %PS_SCRIPT%
  10. pause
  11. exit /b 1
  12. )
  13.  
  14. :checkdeps
  15. set "MKVMERGE="
  16. if exist "C:\Program Files\MKVToolNix\mkvmerge.exe" set "MKVMERGE=C:\Program Files\MKVToolNix\mkvmerge.exe"
  17. if not defined MKVMERGE if exist "C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" set "MKVMERGE=C:\Program Files (x86)\MKVToolNix\mkvmerge.exe"
  18. if not defined MKVMERGE for /f "delims=" %%i in ('where mkvmerge.exe 2^>nul') do set "MKVMERGE=%%i"
  19.  
  20. if not defined MKVMERGE (
  21. echo.
  22. echo ============================================================
  23. echo MKVToolNix is required but was not found.
  24. echo ============================================================
  25. echo.
  26. set /p "INSTALL=Install MKVToolNix automatically via winget? [Y/N]: "
  27. if /i "!INSTALL!"=="Y" goto install
  28. echo.
  29. echo Please install MKVToolNix manually from:
  30. echo https://mkvtoolnix.download/
  31. echo.
  32. pause
  33. exit /b 1
  34. )
  35. goto run
  36.  
  37. :install
  38. where winget >nul 2>&1
  39. if errorlevel 1 (
  40. echo.
  41. echo winget is not available on this system ^(requires Windows 10 1709+ or Windows 11^).
  42. echo Please install MKVToolNix manually from:
  43. echo https://mkvtoolnix.download/
  44. echo.
  45. pause
  46. exit /b 1
  47. )
  48. echo.
  49. echo Installing MKVToolNix via winget...
  50. echo.
  51. winget install --id MoritzBunkus.MKVToolNix -e --accept-source-agreements --accept-package-agreements
  52. if errorlevel 1 (
  53. echo.
  54. echo Installation failed.
  55. echo Please install manually from: https://mkvtoolnix.download/
  56. echo.
  57. pause
  58. exit /b 1
  59. )
  60. echo.
  61. echo Install complete. Continuing...
  62. echo.
  63. goto checkdeps
  64.  
  65. :run
  66. if "%~1"=="" (
  67. echo.
  68. echo Usage:
  69. echo Drag a FOLDER of movies onto this batch file, or run:
  70. echo mkv-batch-reorder.bat "path\to\folder" [--no-backup] [--dry-run]
  71. echo [--filter "TrueHD Atmos"]
  72. echo [--no-log] [--log-path "path\to\log.csv"]
  73. echo.
  74. pause
  75. exit /b 1
  76. )
  77.  
  78. if not exist "%~1\" (
  79. echo.
  80. echo ERROR: Not a folder: %~1
  81. echo This tool processes folders. Use mkv-reorder.bat for a single file.
  82. echo.
  83. pause
  84. exit /b 1
  85. )
  86.  
  87. powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%PS_SCRIPT%" -FolderPath "%~1" %2 %3 %4 %5 %6 %7 %8
  88. set "PSEXIT=%ERRORLEVEL%"
  89.  
  90. echo.
  91. pause
  92. exit /b %PSEXIT%
  93.  
Advertisement
Add Comment
Please, Sign In to add comment