Note: I'm not referring to values being suppressed using the ECHO command. I'm referring to the echoed IF statements when command ECHO is ON: they're missing only the resulting equation when that equation begins with a colon (:) character, either hard-coded or as a variable (not shown since it's irrelevant).
Here's the example batch file I used (name it anything.bat or .cmd):
Code: Select all
@FOR %%$ in ($)do IF :0==:0 ECHO/[Evaluation SUPPRESSED, true]
@FOR %%$ in ($)do IF :0==10 ECHO/[Evaluation SUPPRESSED, false]
@FOR %%$ in ($)do IF 0==:10 ECHO/[Evaluation printed, false]
@FOR %%$ in ($)do IF 0==0 ECHO/[Evaluation printed, true]
@FOR %%$ in ($)do IF(0)==(0) ECHO/[Evaluation printed, true]
@FOR %%$ in ($)do IF (0==(0 ECHO/[Evaluation printed, true]
@FOR %%$ in ($)do IF :0:==:0: ECHO/[Evaluation SUPPRESSED, true]
@FOR %%$ in ($)do IF:0:==:0: ECHO/[Evaluation printed, error] The filename, directory name, or volume label syntax is incorrect.
@FOR %%$ in ($)do IF 0:==0: ECHO/[Evaluation printed, true]
Output:
Code: Select all
C:\Test>IF ECHO/[Evaluation SUPPRESSED, true]
[Evaluation SUPPRESSED, true]
C:\Test>IF ECHO/[Evaluation SUPPRESSED, false]
C:\Test>IF 0 == :10 ECHO/[Evaluation printed, false]
C:\Test>IF 0 == 0 ECHO/[Evaluation printed, true]
[Evaluation printed, true]
C:\Test>IF (0) == (0) ECHO/[Evaluation printed, true]
[Evaluation printed, true]
C:\Test>IF (0 == (0 ECHO/[Evaluation printed, true]
[Evaluation printed, true]
C:\Test>IF ECHO/[Evaluation SUPPRESSED, true]
[Evaluation SUPPRESSED, true]
C:\Test>IF:0:==:0: ECHO/[Evaluation printed, error] The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
C:\Test>IF 0: == 0: ECHO/[Evaluation printed, true]
[Evaluation printed, true]
My question: Why would this be a thing? It just seems so random that leading the equation with a colon suppresses the equation itself from being ECHOed, but I'm wondering if I'm missing some hidden purpose to this behavior, and (even better) if there's a way to stop it and always display the equation when ECHO is ON.