mirror of
https://github.com/arkenfox/user.js.git
synced 2024-10-01 01:35:52 -04:00
fix -updatebatch (#484)
This commit is contained in:
parent
f39112f914
commit
29e2461cd1
19
updater.bat
19
updater.bat
@ -6,7 +6,7 @@ REM ## author: @claustromaniac
|
||||
REM ## version: 4.6
|
||||
REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts
|
||||
|
||||
SET v=4.6
|
||||
SET v=4.7
|
||||
|
||||
VERIFY ON
|
||||
CD /D "%~dp0"
|
||||
@ -31,15 +31,15 @@ IF DEFINED _updateb (
|
||||
IF NOT "!_myname:~0,9!"=="[updated]" (
|
||||
IF EXIST "[updated]!_myname!.bat" (
|
||||
REM ## Phase 3 ##: The new script, with the original name, will:
|
||||
REM * Delete the [updated]*.bat script
|
||||
REM * Delete the [updated]*.bat and *.bat.old scripts
|
||||
REM * Begin the normal routine
|
||||
FC "[updated]!_myname!.bat" "!_myname!.bat" >nul
|
||||
IF ERRORLEVEL 1 (
|
||||
FC "[updated]!_myname!.bat" "!_myname!.bat.old" >nul
|
||||
IF NOT "!errorlevel!"=="0" (
|
||||
CALL :message "Script updated to version !v!"
|
||||
TIMEOUT 3 >nul
|
||||
)
|
||||
REN "[updated]!_myname!.bat" "[updated]!_myname!.bat.old"
|
||||
DEL /F "[updated]!_myname!.bat.old"
|
||||
DEL /F "!_myname!.bat.old" "[updated]!_myname!.bat.old"
|
||||
GOTO begin
|
||||
)
|
||||
REM ## Phase 1 ##
|
||||
@ -64,13 +64,10 @@ IF DEFINED _updateb (
|
||||
TIMEOUT 300 >nul
|
||||
) ELSE (
|
||||
REM ## Phase 2 ##: The [updated]*.bat script will:
|
||||
REM * Copy itself overwriting the original batch
|
||||
REM * Start that script in a new CMD instance
|
||||
REM * Rename the old script and make a copy of itself with the original name.
|
||||
REM * Run that copy in a new CMD instance
|
||||
REM * Exit
|
||||
IF EXIST "!_myname:~9!.bat" (
|
||||
REN "!_myname:~9!.bat" "!_myname:~9!.bat.old"
|
||||
DEL /F "!_myname:~9!.bat.old"
|
||||
)
|
||||
IF EXIST "!_myname:~9!.bat" ( REN "!_myname:~9!.bat" "!_myname:~9!.bat.old" )
|
||||
COPY /B /Y "!_myname!.bat" "!_myname:~9!.bat"
|
||||
START CMD /C "!_myname:~9!.bat" !_myparams!
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user