Oops!  I must've missed an earlier part of this thread, because I didn't realize the 
question was for 9x.  My apologies.

Andre's right.  My solution only works on NT/2000/XP.

Andre's solution will also work on NT/2000/XP, but I would use double-quotes, instead 
of braces (although, they will work), since, in 2000 and XP, you can use the braces or 
parentheses to separate the
IF clause from an ELSE clause.

If not "%somevar%" == "" echo Variable exists

______________
Edgar Torres


-----Original Message-----
From: Correa, Andre [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, September 06, 2001 1:02 PM
To: NT System Admin Issues
Subject: RE: Test Whether Variable Exists


I believe that IF DEFINED only works on NT boxes, not 95/98.  If it is an all NT 
environment, then it is OK.  Otherwise, use syntax as follows:

If not {%somevar%}=={} echo Variable exists

The { sign can be replaced with quotes, but to each their own.  The double = is very 
important, otherwise you will tear out every last strand of hair on your head ....

HTH

____________________________________________
Andre Correa
Senior Manager/Information Technology
Lexitron, Inc
(201) 892-6399

 -----Original Message-----
From:   Torres, Edgar (GEP) [mailto:[EMAIL PROTECTED]]
Sent:   Thursday, September 06, 2001 12:26 PM
To:     NT System Admin Issues
Subject:        RE: Test Whether Variable Exists

if defined MYVAR echo It exists!

______________
Edgar Torres


-----Original Message-----
From: Simon Butler [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 06, 2001 12:22 PM
To: NT System Admin Issues
Subject: Test Whether Variable Exists


Hi,
This should be an easy one but I cannot find the answer after hours of searching. I am 
looking for a way that I can test whether a variable exists and then take action on 
the result. This is for use
in a login script - not a KIX script. I don't want to add, change or delete the 
variable in anyway, just check whether it is there or not. Can anyone suggest a way? 
Thanks, Simon Butler.

http://www.sunbelt-software.com/ntsysadmin_list_charter.htm



http://www.sunbelt-software.com/ntsysadmin_list_charter.htm


http://www.sunbelt-software.com/ntsysadmin_list_charter.htm



http://www.sunbelt-software.com/ntsysadmin_list_charter.htm

Reply via email to