1
0

Updater for Windows 4.1

This commit is contained in:
earthlng 2017-12-26 00:30:49 +01:00 committed by GitHub
commit 1f15e287fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,10 @@
@ECHO OFF & SETLOCAL EnableDelayedExpansion
TITLE ghacks user.js updater
REM ### ghacks-user.js updater for Windows
REM ## ghacks-user.js updater for Windows
REM ## author: @claustromaniac
REM ## version: 4.0
REM ## version: 4.1
REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts
SET _myname=%~n0
SET _myparams=%*
@ -75,7 +76,7 @@ ECHO:
ECHO: ########################################
ECHO: #### user.js Updater for Windows ####
ECHO: #### by claustromaniac ####
ECHO: #### v4.0 ####
ECHO: #### v4.1 ####
ECHO: ########################################
ECHO:
SET /A "_line=0"
@ -164,7 +165,6 @@ IF EXIST user.js (
IF EXIST user.js.bak (
FC user.js.bak user.js >nul && SET "changed=false" || SET "changed=true"
)
ECHO:
IF "!changed!"=="true" (
IF EXIST user.js.old.bak DEL /F user.js.old.bak
CALL :message "Update complete."
@ -180,7 +180,7 @@ IF EXIST user.js (
IF EXIST user.js.bak (REN user.js.bak user.js)
IF EXIST user.js.old.bak (REN user.js.old.bak user.js.bak)
CALL :message "Update failed. Make sure PowerShell is allowed internet access."
CALL :message "No changes were made."
ECHO: No changes were made.
)
IF NOT DEFINED _log (
IF NOT DEFINED _ua (PAUSE)
@ -190,9 +190,9 @@ EXIT /B
REM ########### Message Function ###########
:message
SETLOCAL DisableDelayedExpansion
ECHO:
IF NOT DEFINED _log (ECHO:)
ECHO: %~1
ECHO:
IF NOT DEFINED _log (ECHO:)
ENDLOCAL
GOTO :EOF
REM ############ Merge function ############
@ -230,28 +230,31 @@ ENDLOCAL
GOTO :EOF
REM ############### Help ##################
:showhelp
MODE 80,38
MODE 80,43
CLS
CALL :message "Available switches (case-insensitive):"
CALL :message "Available arguments (case-insensitive):"
CALL :message " -log"
ECHO: Writes the console output to a logfile (user.js-update-log.txt)
ECHO: Write the console output to a logfile (user.js-update-log.txt)
CALL :message " -logP"
ECHO: Like log, but also opens the logfile after updating.
ECHO: Like -log, but also open the logfile after updating.
CALL :message " -merge"
ECHO: Merges overrides instead of appending them. Comments and _user.js.parrot
ECHO: lines are appended normally. Overrides for inactive (commented out)
ECHO: Merge overrides instead of appending them. One-line comments and
ECHO: _user.js.parrot lines are appended normally. Overrides for inactive
ECHO: user.js prefs will be appended. When -Merge and -MultiOverrides are used
ECHO: together, a user-overrides-merged.js file is also generated in the root
ECHO: directory for quick reference. It contains only the merged data from
ECHO: override files and can be safely discarded after updating, or used as the
ECHO: new user-overrides.js. When there are conflicting records for the same
ECHO: pref, the value of the last one declared will be used.
ECHO: pref, the value of the last one declared will be used. Visit the wiki
ECHO: for usage examples and more detailed information.
CALL :message " -multiOverrides"
ECHO: uses any and all .js files in a user.js-overrides sub-folder as overrides
ECHO: Use any and all .js files in a user.js-overrides sub-folder as overrides
ECHO: instead of the default user-overrides.js file. Files are appended in
ECHO: alphabetical order.
CALL :message " -unattended"
ECHO: Run without user input.
CALL :message " -updatebatch"
ECHO: The script will update itself on execution.
ECHO: Update the script itself on execution, before the normal routine.
CALL :message ""
PAUSE
CLS