I'm not sure where to post this, it's just a reference to a minor bug in batch processing that I do know how to work around. However, in my own programming my goal is to eliminate all bugs, whether or not there is a simple workaround for them.
To start, a batch file with the given lines:
@Echo Off
If 1 @Echo One One
Iff 1 Then
@Echo One Two
EndIff
If 9 @Echo Nine One
Iff 9 Then
@Echo Nine Two
EndIff
If 0 @Echo Zero One
Iff 0 Then
@Echo Zero Two
EndIff
Output from above batch file:
Z:\BadSample.bat [2] Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...]
One Two
Z:\BadSample.bat [6] Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...]
Nine Two
Z:\BadSample.bat [10] Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...
Bottom line: For the "IFF" statement, a value of zero is "false" and any non-zero value is "true", whereas for the "IF" statement there has to be an honest to goodness conditional expression such as "0 != 1" (true) or "1 == 0" (false). Just reporting a minor (kind of weird, I must admit!:)) inconsistency...
To start, a batch file with the given lines:
@Echo Off
If 1 @Echo One One
Iff 1 Then
@Echo One Two
EndIff
If 9 @Echo Nine One
Iff 9 Then
@Echo Nine Two
EndIff
If 0 @Echo Zero One
Iff 0 Then
@Echo Zero Two
EndIff
Output from above batch file:
Z:\BadSample.bat [2] Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...]
One Two
Z:\BadSample.bat [6] Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...]
Nine Two
Z:\BadSample.bat [10] Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...
Bottom line: For the "IFF" statement, a value of zero is "false" and any non-zero value is "true", whereas for the "IF" statement there has to be an honest to goodness conditional expression such as "0 != 1" (true) or "1 == 0" (false). Just reporting a minor (kind of weird, I must admit!:)) inconsistency...