Skip to content

Instantly share code, notes, and snippets.

@PureOcean
Last active October 20, 2022 15:30
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 PureOcean/8bf2959949a76338760735353d7f0668 to your computer and use it in GitHub Desktop.
Save PureOcean/8bf2959949a76338760735353d7f0668 to your computer and use it in GitHub Desktop.
These commands automatically downloads and installs ExplorerPatcher the latest pre-prelease version.
@echo off
cd /d "%~dp0"
ECHO.
ECHO ::: ExplorerPatcher Updater ::: by PureOcean (2022-10-14+20)
ECHO.
ECHO Detecting ExplorerPatcher's latest version...
FOR /F "usebackq tokens=*" %%A in (`powershell -c "$ProgressPreference = 'SilentlyContinue'; (Invoke-WebRequest 'https://api.github.com/repos/valinet/ExplorerPatcher/releases' | ConvertFrom-Json)[0].assets | Select-Object -Property browser_download_url | Format-Table -HideTableHeaders"`) DO set ExplorerPatcherURL=%%A
FOR /F "tokens=7 delims=/_" %%A in ("%ExplorerPatcherURL%") Do set ExplorerPatcherVersion=%%A
IF NOT EXIST "%ProgramFiles%\ExplorerPatcher\ExplorerPatcher.amd64.dll" GOTO Download
FOR /f %%i in ('Powershell.exe -c "(Get-Item '%ProgramFiles%\ExplorerPatcher\ExplorerPatcher.amd64.dll').VersionInfo | Select-Object -ExpandProperty ProductVersion"') DO SET InstalledVer=%%i
IF "%InstalledVer:.=%" GEQ "%ExplorerPatcherVersion:.=%" ( Echo ExplorerPatcher's latest version already installed. Exiting... && EXIT /b )
:Download
ECHO.
ECHO Downloading ExplorerPatcher version %ExplorerPatcherVersion%...
ECHO.
CURL -# -L -R "%ExplorerPatcherURL%" --output "ExplorerPatcher_%ExplorerPatcherVersion%.exe"
ECHO.
ECHO Installing ExplorerPatcher %ExplorerPatcherVersion%...
"ExplorerPatcher_%ExplorerPatcherVersion%.exe" /install
ECHO.
ECHO Done.
pause >nul
exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment