1
0
This commit is contained in:
claustromaniac 2017-11-30 22:17:58 +00:00
parent e5d00be8f0
commit fc47792df2

View File

@ -3,7 +3,7 @@ TITLE ghacks user.js updater
REM ### ghacks-user.js updater for Windows REM ### ghacks-user.js updater for Windows
REM ## author: @claustromaniac REM ## author: @claustromaniac
REM ## version: 3.1a REM ## version: 3.1a1
SET _myname=%~n0 SET _myname=%~n0
SET _myparams=%* SET _myparams=%*
@ -39,9 +39,14 @@ IF DEFINED _updateb (
IF NOT "!_myname:~0,9!"=="[updated]" ( IF NOT "!_myname:~0,9!"=="[updated]" (
IF EXIST "[updated]!_myname!.bat" ( IF EXIST "[updated]!_myname!.bat" (
DEL /F "[updated]!_myname!.bat" DEL /F "[updated]!_myname!.bat"
ECHO Script updated^^!
ECHO.
TIMEOUT 3 >nul
CLS
ECHO.
GOTO begin GOTO begin
) )
ECHO Checking updater version... ECHO Updating script...
ECHO. ECHO.
REM Uncomment the next line and comment the powershell call for testing. REM Uncomment the next line and comment the powershell call for testing.
REM COPY /B /V /Y "!_myname!.bat" "[updated]!_myname!.bat" REM COPY /B /V /Y "!_myname!.bat" "[updated]!_myname!.bat"
@ -54,15 +59,14 @@ IF DEFINED _updateb (
) ELSE ( ) ELSE (
ECHO Failed. Make sure PowerShell is allowed internet access. ECHO Failed. Make sure PowerShell is allowed internet access.
ECHO. ECHO.
TIMEOUT 120 TIMEOUT 120 >nul
EXIT /B EXIT /B
) )
) ELSE ( ) ELSE (
IF "!_myname!"=="[updated]" ( IF "!_myname!"=="[updated]" (
ECHO.
ECHO The [updated] label is reserved. Rename this script and try again. ECHO The [updated] label is reserved. Rename this script and try again.
ECHO. ECHO.
TIMEOUT 300 TIMEOUT 300 >nul
) ELSE ( ) ELSE (
COPY /B /V /Y "!_myname!.bat" "!_myname:~9!.bat" COPY /B /V /Y "!_myname!.bat" "!_myname:~9!.bat"
START CMD /C "!_myname:~9!.bat" !_myparams! START CMD /C "!_myname:~9!.bat" !_myparams!
@ -211,7 +215,7 @@ REM ###### Merge function ######
:merge :merge
SETLOCAL disabledelayedexpansion SETLOCAL disabledelayedexpansion
( (
FOR /F "tokens=1,* delims=]" %%G IN ('find /n /v "" ^< "%~1"') DO ( FOR /F "tokens=1,* delims=]" %%G IN ('FIND /n /v "" ^< "%~1"') DO (
SET "_pref=%%H" SET "_pref=%%H"
SETLOCAL enabledelayedexpansion SETLOCAL enabledelayedexpansion
SET "_temp=!_pref: =!" SET "_temp=!_pref: =!"