Skip to content

Instantly share code, notes, and snippets.

@Jan200101
Last active July 1, 2018 18:26
Show Gist options
  • Select an option

  • Save Jan200101/d398d4897c75f2cd0fc4b6c6325acb7a to your computer and use it in GitHub Desktop.

Select an option

Save Jan200101/d398d4897c75f2cd0fc4b6c6325acb7a to your computer and use it in GitHub Desktop.
@echo off
REM Sentry#4141
REM https://gist.github.com/Jan200101/d398d4897c75f2cd0fc4b6c6325acb7a
title SalienCheat - Updater
cls
where git > nul
if exist .git if %ERRORLEVEL% equ 0 (
git reset --hard
git pull
goto exit
)
where curl > NUL
if %ERRORLEVEL% equ 0 goto curl
where certutil > NUL
if %ERRORLEVEL% equ 0 goto certutil
where wget > NUL
if %ERRORLEVEL% equ 0 goto wget
where powershell > NUL
if %ERRORLEVEL% equ 0 goto powershell
goto nohope
REM curl should be preinstalled with Windows 10 and can be downloaded manually by users. If its present use it as the first option
:curl
set program=curl
set cheatphp=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.php --output cheat.php --silent
set cheatbat=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.bat --output cheat.bat --silent
set downloadphp=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/downloadphp.ps1 --output downloadphp.ps1 --silent
set cacert=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cacert.pem --output cacert.pem --silent
goto download
REM certutil is part of certificate services and is preinstalled with windows 10. This is not compatible with older windows version but seems to work faster than the powershell solution
:certutil
set program=certutil
set cheatphp=-urlcache -split -f "https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.php" cheat.php
set cheatbat=-urlcache -split -f "https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.bat" cheat.bat
set downloadphp=-urlcache -split -f "https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/downloadphp.ps1" downloadphp.ps1
set cacert=-urlcache -split -f "https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cacert.pem" cacert.pem
goto download
REM in the edge case someone did install wget
:wget
set program=wget
set cheatphp=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.php -O cheat.php -q
set cheatbat=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.bat -O cheat.bat -q
set downloadphp=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/downloadphp.ps1 -O downloadphp.ps1 -q
set cacert=https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cacert.pem -O cacert.pem -q
goto download
REM downloads the files over a powershell 2.0 compatible command which comes preinstalled with windows 7. The downloadphp script may not be compatible with Windows 7
:powershell
set program=powershell
set cheatphp=-Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.php', 'cheat.php')"
set cheatbat=-Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cheat.bat', 'cheat.bat')"
set downloadphp=-Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/downloadphp.ps1', 'downloadphp.ps1')"
set cacert=-Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/SteamDatabase/SalienCheat/master/cacert.pem', 'cacert.pem')"
goto download
:download
echo Using %program%
echo(
echo( Downloading cheat.php
%program% %cheatphp% > NUL
echo( Done
echo(
echo( Downloading cheat.bat
%program% %cheatbat% > NUL
echo( Done
echo(
echo( Downloading downloadphp.ps1
%program% %downloadphp% > NUL
echo( Done
echo(
echo( Downloading cacert.pem
%program% %cacert% > NUL
echo( Done
echo(
goto exit
:nohope
echo( No Program to update found
goto exit
:exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment