mirror of
https://github.com/arkenfox/user.js.git
synced 2025-04-30 14:03:40 +02:00
Format date and time consistently.
The format is chosen to mirror updater.sh. The ISO format alternative is included as a remark.
This commit is contained in:
parent
8a65c5a7ba
commit
b0ba1d2cb9
2 changed files with 12 additions and 6 deletions
|
@ -31,8 +31,11 @@ IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current director
|
||||||
CALL :strlenCheck
|
CALL :strlenCheck
|
||||||
CALL :FFcheck
|
CALL :FFcheck
|
||||||
CALL :message "Backing up prefs.js..."
|
CALL :message "Backing up prefs.js..."
|
||||||
SET "_time=%time: =0%"
|
FOR /F "usebackq tokens=1,2 delims==" %%i IN (`wmic os get LocalDateTime /VALUE 2^>NUL`) DO IF '.%%i.'=='.LocalDateTime.' SET ldt=%%j
|
||||||
COPY /B /V /Y prefs.js "prefs-backup-%date:/=-%_%_time::=.%.js"
|
SET ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2%_%ldt:~8,2%%ldt:~10,2%
|
||||||
|
REM For ISO format use:
|
||||||
|
REM SET ldt=%ldt:~0,4%%ldt:~4,2%%ldt:~6,2%T%ldt:~8,2%%ldt:~10,2%%ldt:~12,6%
|
||||||
|
COPY /B /V /Y prefs.js "prefs-backup-%ldt%.js"
|
||||||
CALL :message "Cleaning prefs.js..."
|
CALL :message "Cleaning prefs.js..."
|
||||||
CALL :cleanup
|
CALL :cleanup
|
||||||
CALL :message "All done!"
|
CALL :message "All done!"
|
||||||
|
|
11
updater.bat
11
updater.bat
|
@ -3,10 +3,10 @@ TITLE arkenfox user.js updater
|
||||||
|
|
||||||
REM ## arkenfox user.js updater for Windows
|
REM ## arkenfox user.js updater for Windows
|
||||||
REM ## author: @claustromaniac
|
REM ## author: @claustromaniac
|
||||||
REM ## version: 4.16
|
REM ## version: 4.17
|
||||||
REM ## instructions: https://github.com/arkenfox/user.js/wiki/5.1-Updater-[Options]#-windows
|
REM ## instructions: https://github.com/arkenfox/user.js/wiki/5.1-Updater-[Options]#-windows
|
||||||
|
|
||||||
SET v=4.15
|
SET v=4.17
|
||||||
|
|
||||||
VERIFY ON
|
VERIFY ON
|
||||||
CD /D "%~dp0"
|
CD /D "%~dp0"
|
||||||
|
@ -177,8 +177,11 @@ IF EXIST user.js.new (
|
||||||
IF DEFINED _singlebackup (
|
IF DEFINED _singlebackup (
|
||||||
MOVE /Y user.js user.js.bak >nul
|
MOVE /Y user.js user.js.bak >nul
|
||||||
) ELSE (
|
) ELSE (
|
||||||
SET "_time=!time: =0!"
|
FOR /F "usebackq tokens=1,2 delims==" %%i IN (`wmic os get LocalDateTime /VALUE 2^>NUL`) DO IF '.%%i.'=='.LocalDateTime.' SET ldt=%%j
|
||||||
MOVE /Y user.js "user-backup-!date:/=-!_!_time::=.!.js" >nul
|
SET ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2%_%ldt:~8,2%%ldt:~10,2%
|
||||||
|
REM For ISO format use:
|
||||||
|
REM SET ldt=%ldt:~0,4%%ldt:~4,2%%ldt:~6,2%T%ldt:~8,2%%ldt:~10,2%%ldt:~12,6%
|
||||||
|
MOVE /Y user.js "user-backup-%ldt%.js" >nul
|
||||||
)
|
)
|
||||||
REN user.js.new user.js
|
REN user.js.new user.js
|
||||||
CALL :message "Update complete."
|
CALL :message "Update complete."
|
||||||
|
|
Loading…
Add table
Reference in a new issue