@IF[condition,string1,string2]: Evaluates condition according to the rules described in Conditional Expressions, and if true, it returns string1, otherwise it returns string2. Leading and trailing white space in string1 and string2 is retained. Either string may be empty or contain white space only. WARNING: Both string1 and string2 are evaluated whether or not used. Do not use @IF if evaluating either one of the strings may fail; use the IF or IFF command instead.
|%@IF[2 == 2,Correct!,Oops!] |
|echo Good %@if[%_hour ge 12,evening,morning]!|
|displays Good morning! in the AM hours and Good evening! in the PM hours.|
|3)||Assuming A and C are files in the current directory, but B is a subdirectory, the command:|
|for %x in (A B C) echo "%x" is %@if[isfile "%x", ,not] a file|