Skip to content

Instantly share code, notes, and snippets.

@Diskmaster
Last active May 18, 2019 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Diskmaster/fae4969a41fcc7240c3d950f90c87970 to your computer and use it in GitHub Desktop.
Save Diskmaster/fae4969a41fcc7240c3d950f90c87970 to your computer and use it in GitHub Desktop.
@echo off
set filename=%~n0
rem %~n0 obtains the filename, without the .bat extension.
set realname=%filename:~0,-6%
rem This step cuts the .RUNME from the batch filename.
set patchname=%realname%.patch
rem And with the cut realname, add the .patch extension.
rem echo DEBUG %filename% %realname% %patchname%
rem Debugging statement, uncomment if you want to see it in action.
echo Applying %patchname% to the unsubtitled video file.
echo.
rem xdelta3.exe -d %patchname% 2> NUL - original xdelta3 command.
rem The one below adds -q (quiet), which omits the source part of the output.
rem xdelta3, at the least the version I have omits only the output filename with this switchset.
xdelta3.exe -q -d %patchname%
if %ERRORLEVEL%==9009 goto missingxdelta
if %ERRORLEVEL%==1 goto patchfailed
echo.
echo Patch appears successful.
echo.
ping -n 3 127.0.0.1>nul
pause
goto :end
:missingxdelta
echo.
echo Unable to find the xdelta patching utility anywhere in your PATH.
echo Download a copy from http://xdelta.org and put it somewhere in your PATH,
echo the folder you tend to put the raw and patch in is a good candidate. Another
echo reasonable candidate is C:\Windows\system32\
echo.
echo Your current PATH is: %PATH%
echo.
ping -n 3 127.0.0.1>nul
pause
goto :end
:patchfailed
echo.
echo The xdelta patching utility was unable to apply the patch. Make sure the original,
echo unedited raw file and the patch are all in the same folder as this script before
echo attempting to run again.
echo.
ping -n 3 127.0.0.1>nul
pause
goto :end
:end
echo.
rem Updated by Diskmaster / @TomeofElectrum for Over-Time - revision 3.1
rem src: https://gist.github.com/Diskmaster/fae4969a41fcc7240c3d950f90c87970
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment