-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOneAudio.cmd
47 lines (43 loc) · 1.82 KB
/
OneAudio.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "WindowTitle=%~n0"
setlocal EnableDelayedExpansion
for /F "tokens=1,2" %%G in ("!CMDCMDLINE!") do (
if /I "%%~nG" == "cmd" if /I "%%~H" == "/c" (
endlocal
start %SystemRoot%\System32\cmd.exe /D /K %0
if not errorlevel 1 exit /B
setlocal EnableDelayedExpansion
)
)
title !WindowTitle!
endlocal
for /F delims^=^=^ eol^= %%G in ('set ^| %SystemRoot%\System32\findstr.exe /B /I /L /V "ComSpec= PATH= PATHEXT= SystemRoot= TEMP= TMP="') do set "%%G="
if exist "%~dp0mkvmerge.exe" (set "ToolsPath=%~dp0") else if exist mkvmerge.exe (set "ToolsPath=%CD%") else for %%I in (mkvmerge.exe) do set "ToolsPath=%%~dp$PATH:I"
if not defined ToolsPath echo ERROR: Could not find mkvmerge.exe!& exit /B 2
if "%ToolsPath:~-1%" == "\" set "ToolsPath=%ToolsPath:~0,-1%"
if not exist "%ToolsPath%\mkvpropedit.exe" echo ERROR: Could not find mkvpropedit.exe!& exit /B 2
for /F "tokens=*" %%G in ('%SystemRoot%\System32\chcp.com') do for %%H in (%%G) do set /A "CodePage=%%H" 2>nul
%SystemRoot%\System32\chcp.com 65001 >nul 2>&1
(
for /f "delims=" %%G in (ExtraTracksList.txt) do (
echo --^> Processing file "%%G" ...
mkvmerge.exe -o "%%~dpnG.oneaudio%%~xG" -a 1 -S -M -T -B --no-global-tags --no-chapters --ui-language en "%%~fG"
if not errorlevel 1 (
echo --^> Deleting old file
del /f "%%~fG"
echo --^> Renaming new file
ren "%%~dpnG.oneaudio%%~xG" "%%~nxG"
) else (
echo Warnings/errors generated during remuxing, original file not deleted, check errors.txt
mkvmerge.exe -i --ui-language en "%%~fG" >> Errors.txt
del "%%~dpnG.oneaudio%%~xG" 2>nul
)
echo.
echo ##########
echo.
)
if exist ExtraTracksList.txt del ExtraTracksList.txt 2>nul
%SystemRoot%\System32\chcp.com %CodePage% >nul
)
endlocal