How to? Correctly use defined test

Jun 11, 2008
26
0
#1
Hi

I recently tried to (unsuccessfully) to use "defined" like this:
Code:
setlocal
set var=%1

iff defined %var then
echo var defined as %var
else
echo var not defined
endiff

echo.
echo end defined test
This code always returns "var not defined". My expectation was that it should behave the same as if I had used "iff !%var! != !! then". What have I misunderstood about using defined?

John