mirror of
https://github.com/arkenfox/user.js.git
synced 2024-10-01 01:35:52 -04:00
Merge pull request #309 from claustromaniac/master
Updater for Windows 3.2
This commit is contained in:
commit
28f06b41e3
35
updater.bat
35
updater.bat
@ -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.1
|
REM ## version: 3.2
|
||||||
|
|
||||||
SET _myname=%~n0
|
SET _myname=%~n0
|
||||||
SET _myparams=%*
|
SET _myparams=%*
|
||||||
@ -39,11 +39,10 @@ IF DEFINED _updateb (
|
|||||||
REM The normal flow here goes from phase 1 to phase 2 and then phase 3.
|
REM The normal flow here goes from phase 1 to phase 2 and then phase 3.
|
||||||
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
|
REM ## Phase 3 ##: The new script, with the original name, will:
|
||||||
REM The new script, with the original name, should:
|
REM * Delete the [updated]*.bat script
|
||||||
REM Delete the [updated]*.bat script
|
REM * Begin the normal routine
|
||||||
REM Begin the normal script routine.
|
REN "[updated]!_myname!.bat" "[updated]!_myname!.bat.old"
|
||||||
REN [updated]!_myname!.bat [updated]!_myname!.bat.old
|
|
||||||
DEL /F "[updated]!_myname!.bat.old"
|
DEL /F "[updated]!_myname!.bat.old"
|
||||||
ECHO Script updated^^!
|
ECHO Script updated^^!
|
||||||
ECHO.
|
ECHO.
|
||||||
@ -52,11 +51,10 @@ IF DEFINED _updateb (
|
|||||||
ECHO.
|
ECHO.
|
||||||
GOTO begin
|
GOTO begin
|
||||||
)
|
)
|
||||||
REM Phase 1
|
REM ## Phase 1 ##
|
||||||
REM -updatebatch will:
|
REM * Download new batch and name it [updated]*.bat
|
||||||
REM Download new batch and name it [updated]*.bat
|
REM * Start that script in a new CMD window
|
||||||
REM Open that script in a new CMD window.
|
REM * Exit
|
||||||
REM Exit
|
|
||||||
ECHO Updating script...
|
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.
|
||||||
@ -79,14 +77,13 @@ IF DEFINED _updateb (
|
|||||||
ECHO.
|
ECHO.
|
||||||
TIMEOUT 300 >nul
|
TIMEOUT 300 >nul
|
||||||
) ELSE (
|
) ELSE (
|
||||||
REM Phase 2
|
REM ## Phase 2 ##: The [updated]*.bat script will:
|
||||||
REM The [updated]*.bat script will:
|
REM * Copy itself overwriting the original batch
|
||||||
REM Copy itself overwriting the original batch.
|
REM * Start that script in a new CMD instance
|
||||||
REM Start that script 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"
|
||||||
DEL /F !_myname:~9!.bat.old
|
|
||||||
)
|
)
|
||||||
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!
|
||||||
|
Loading…
Reference in New Issue
Block a user