Rob van der Woude's Scripting Pages

Known Issues with BatCodeCheck

# Reported By Tested
Versions
Type Description Solved
Version Remarks
Code
1 Yours Truly all false positive Double percent sign in FOR loops generate false "Unterminated percent signs" warning
FOR %%A IN (a b c) DO ECHO %%A
2 Denis St-Pierre 0.27 missed issue Test for undefined variables misses the second variable in this line 0.30.4 Two issues here: [A] the list of defined variables was populated by looking for SET ...= in the entire file, including comments, so a modified test was required to exclude commented lines, and [B] only the first variable in a line was checked
echo !_PARAMBOTH! >> "!_CMDLOG!"
REM SHOULD FLAG !_CMDLOG! is not defined e.g. Set _CMDLOG= not found anywhere in the script
3 Denis St-Pierre all false positive Opening doublequote followed by space generates false "Unterminated doublequotes" warning
call :SubLog " Echo Please install MSdotNetExtended_v40r1 or equivalent. Exiting..."
REM FALSE_POSITIVE Unterminated doublequotes. But they are terminated

call :SubLog "Echo Please install MSdotNetExtended_v40r1 or equivalent. Exiting..."
REM BatCodeCheck is OK with it if you change " Echo to "Echo
4 Denis St-Pierre all false positive Single exclamation mark, whether escaped or not, generates false "Unterminated exclamation marks" warning 0.30.3 Where most special characters require a single caret to be escaped, exclamation marks require a double caret; an extra test was required to prevent this false positive
msiexec.exe /i !_MSICODE.1! REMOVE=OutlookExt /l*v "!_PKGNAME!_RemoveIBIntegrate.LOG" /qb!-
REM FALSE_POSITIVE Unterminated exclamation marks. The ! in /qb!- is a valid parameter for MSIEXEC

msiexec.exe /i !_MSICODE.1! REMOVE=OutlookExt /l*v "!_PKGNAME!_RemoveIBIntegrate.LOG" /qb^^!-
REM FALSE_POSITIVE Unterminated exclamation marks. Don't know if/qb^^!- will be accepted by MSIEXEC or not.
5 Denis St-Pierre 0.30.2 false positive GOTO in code block returns false "label not found" warning if closing parenthesis immediately follows label name 0.30.3 Though this issue is solved, one-liners will always remain a pain in the ... and should be avoided; use (indented) code blocks instead:
if defined # (
    set #=%#:~1%
    set /A length += 1
    goto stringLengthLoop
)

You may also want to try BatCodeCheck's optional command line switch /S to have the program split the one-liners into separate, indented command lines.
if defined # (set #=%#:~1%&set /A length += 1&goto stringLengthLoop)
6 Yours Truly 0.32 bug With /S switch, BatCodeCheck splits lines on ampersands (as intended), including ampersands in 1>&2 or 2>&1 (not intended) 0.32.1  
1>&2 ECHO This text is sent to Standard Error
7 Alfons van Zwol 0.36 false positive CALLing a batch file whose path contains %~dp0 like variables results in warning File not found 0.37  
CALL "%~dp0otherbatchfile.bat" %1
8 Yours Truly 0.36 false positive CALLing a batch file whose path contains variables results in warning File not found  
CALL "%ProgramData%\otherbatchfile.bat" %*
9 Yours Truly all feature request Group repeated messages    

 

Latest BatCodeCheck version: 0.37 beta (2021-05-18)


page last uploaded: 2021-05-18, 20:41