v2.4 - add strlen check for prefs.js
cmd.exe has a command line length limit of 8192 characters. Abort if prefs.js contains strings that would get dropped while recreating the new prefs.js.
This commit is contained in:
parent
27dd6aa62d
commit
11977e7017
@ -3,7 +3,7 @@ TITLE prefs.js cleaner
|
|||||||
|
|
||||||
REM ### prefs.js cleaner for Windows
|
REM ### prefs.js cleaner for Windows
|
||||||
REM ## author: @claustromaniac
|
REM ## author: @claustromaniac
|
||||||
REM ## version: 2.3
|
REM ## version: 2.4
|
||||||
|
|
||||||
CD /D "%~dp0"
|
CD /D "%~dp0"
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ ECHO:
|
|||||||
ECHO ########################################
|
ECHO ########################################
|
||||||
ECHO #### prefs.js cleaner for Windows ####
|
ECHO #### prefs.js cleaner for Windows ####
|
||||||
ECHO #### by claustromaniac ####
|
ECHO #### by claustromaniac ####
|
||||||
ECHO #### v2.3 ####
|
ECHO #### v2.4 ####
|
||||||
ECHO ########################################
|
ECHO ########################################
|
||||||
ECHO:
|
ECHO:
|
||||||
CALL :message "This script should be run from your Firefox profile directory."
|
CALL :message "This script should be run from your Firefox profile directory."
|
||||||
@ -28,6 +28,7 @@ IF ERRORLEVEL 3 (EXIT /B)
|
|||||||
IF ERRORLEVEL 2 (GOTO :showhelp)
|
IF ERRORLEVEL 2 (GOTO :showhelp)
|
||||||
IF NOT EXIST "user.js" (CALL :abort "user.js not found in the current directory." 30)
|
IF NOT EXIST "user.js" (CALL :abort "user.js not found in the current directory." 30)
|
||||||
IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30)
|
IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30)
|
||||||
|
CALL :strlenCheck
|
||||||
CALL :FFcheck
|
CALL :FFcheck
|
||||||
CALL :message "Backing up prefs.js..."
|
CALL :message "Backing up prefs.js..."
|
||||||
SET "_time=%time: =0%"
|
SET "_time=%time: =0%"
|
||||||
@ -50,6 +51,21 @@ ECHO:
|
|||||||
ECHO: %~1
|
ECHO: %~1
|
||||||
ECHO:
|
ECHO:
|
||||||
GOTO :EOF
|
GOTO :EOF
|
||||||
|
REM ### string length Check Function ####
|
||||||
|
:strlenCheck
|
||||||
|
SET /a cnt=0
|
||||||
|
setlocal ENABLEDELAYEDEXPANSION
|
||||||
|
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO (
|
||||||
|
ECHO:%%H >nul
|
||||||
|
SET /a cnt += 1
|
||||||
|
IF /I "%%G" NEQ "!cnt!" (
|
||||||
|
ECHO:
|
||||||
|
CALL :message "ERROR: line !cnt! in prefs.js is too long."
|
||||||
|
(CALL :abort "Aborting ..." 30)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
endlocal
|
||||||
|
GOTO :EOF
|
||||||
REM ####### Firefox Check Function ######
|
REM ####### Firefox Check Function ######
|
||||||
:FFcheck
|
:FFcheck
|
||||||
TASKLIST /FI "IMAGENAME eq firefox.exe" 2>NUL | FIND /I /N "firefox.exe">NUL
|
TASKLIST /FI "IMAGENAME eq firefox.exe" 2>NUL | FIND /I /N "firefox.exe">NUL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user