mirror of
https://github.com/arkenfox/user.js.git
synced 2025-02-23 02:43:56 +00: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 ## version: 4.6
|
||||||
REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts
|
REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts
|
||||||
|
|
||||||
SET v=4.6
|
SET v=4.7
|
||||||
|
|
||||||
VERIFY ON
|
VERIFY ON
|
||||||
CD /D "%~dp0"
|
CD /D "%~dp0"
|
||||||
@ -31,15 +31,15 @@ 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" (
|
||||||
REM ## Phase 3 ##: The new script, with the original name, will:
|
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
|
REM * Begin the normal routine
|
||||||
FC "[updated]!_myname!.bat" "!_myname!.bat" >nul
|
FC "[updated]!_myname!.bat" "!_myname!.bat.old" >nul
|
||||||
IF ERRORLEVEL 1 (
|
IF NOT "!errorlevel!"=="0" (
|
||||||
CALL :message "Script updated to version !v!"
|
CALL :message "Script updated to version !v!"
|
||||||
TIMEOUT 3 >nul
|
TIMEOUT 3 >nul
|
||||||
)
|
)
|
||||||
REN "[updated]!_myname!.bat" "[updated]!_myname!.bat.old"
|
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
|
GOTO begin
|
||||||
)
|
)
|
||||||
REM ## Phase 1 ##
|
REM ## Phase 1 ##
|
||||||
@ -64,13 +64,10 @@ IF DEFINED _updateb (
|
|||||||
TIMEOUT 300 >nul
|
TIMEOUT 300 >nul
|
||||||
) ELSE (
|
) ELSE (
|
||||||
REM ## Phase 2 ##: The [updated]*.bat script will:
|
REM ## Phase 2 ##: The [updated]*.bat script will:
|
||||||
REM * Copy itself overwriting the original batch
|
REM * Rename the old script and make a copy of itself with the original name.
|
||||||
REM * Start that script in a new CMD instance
|
REM * Run that copy in a new CMD instance
|
||||||
REM * Exit
|
REM * Exit
|
||||||
IF EXIST "!_myname:~9!.bat" (
|
IF EXIST "!_myname:~9!.bat" ( REN "!_myname:~9!.bat" "!_myname:~9!.bat.old" )
|
||||||
REN "!_myname:~9!.bat" "!_myname:~9!.bat.old"
|
|
||||||
DEL /F "!_myname:~9!.bat.old"
|
|
||||||
)
|
|
||||||
COPY /B /Y "!_myname!.bat" "!_myname:~9!.bat"
|
COPY /B /Y "!_myname!.bat" "!_myname:~9!.bat"
|
||||||
START CMD /C "!_myname:~9!.bat" !_myparams!
|
START CMD /C "!_myname:~9!.bat" !_myparams!
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user