From 5b931b06e8167d092f5df059421fb221dd02a85e Mon Sep 17 00:00:00 2001 From: earthlng Date: Tue, 28 Nov 2017 17:34:14 +0100 Subject: [PATCH 1/2] updater.bat auto-update part --- updater.bat | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/updater.bat b/updater.bat index 76de40d..376d342 100644 --- a/updater.bat +++ b/updater.bat @@ -36,6 +36,30 @@ SHIFT GOTO parse :endparse ECHO. +IF DEFINED _updateb ( + ECHO Checking updater version... + ECHO. + DEL /F "!_myname!-updated.bat" 2>nul + powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/ghacksuserjs/ghacks-user.js/raw/master/updater.bat', '!_myname!-updated.bat')" >nul + IF EXIST "!_myname!-updated.bat" ( + CLS + START CMD /C "!_myname!-updated.bat" !_myparams! + DEL /F "!_myname!.bat" 2>nul + EXIT /B + ) ELSE ( + ECHO Failed. Make sure PowerShell is allowed internet access. + ECHO. + PAUSE + EXIT /B + ) +) ELSE ( + IF NOT "!_myname!"=="!_myname:-updated=X!" ( + CALL :begin + REN "!_myname!.bat" "!_myname:-updated=!.bat" + EXIT /B + ) +) +:begin SET /A "_line=0" IF NOT EXIST user.js ( ECHO user.js not detected in the current directory. From ed4c9202b975ed27ca5713a35b3311b7af157221 Mon Sep 17 00:00:00 2001 From: earthlng Date: Tue, 28 Nov 2017 18:15:14 +0100 Subject: [PATCH 2/2] updater.bat v3.0 the real deal hopefully :fingers_crossed: --- updater.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updater.bat b/updater.bat index 376d342..8e2703c 100644 --- a/updater.bat +++ b/updater.bat @@ -43,7 +43,7 @@ IF DEFINED _updateb ( powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/ghacksuserjs/ghacks-user.js/raw/master/updater.bat', '!_myname!-updated.bat')" >nul IF EXIST "!_myname!-updated.bat" ( CLS - START CMD /C "!_myname!-updated.bat" !_myparams! + START CMD /C "!_myname!-updated.bat" !_myparams:-updatebatch=! DEL /F "!_myname!.bat" 2>nul EXIT /B ) ELSE (