|The first one should work, if %var% contains anything at all, including a space if will fail, especially if it contains double quotes.|
if not defined var echo empty
Again if it contains anything at all......
I have no idea what you are trying to do with:
echo %var% >gives> %var%
It displays some interesting behaviour but nothing particularly useful.
Gee I'm slow, beaten by minutes...
If you want to test a variable with "if [not] defined" you need to leave out the %'s or !'s otherwise it will check if the contents of the variable is itself a defined varable.
To kill a variable you simply put nothing after the "=", "set var="