Does somebody knows how to set a variable to null??
I put a set of variables at the beginning of my batch file like that
VAR1=
VAR2=
but i notices it causes the ERRORLEVEL be 1
How can i set a null value to these variables???
Thanks.
The Clue is in the Question
SET VAR1=
but there's no point as any nonexistent variable equates to null anyway.
As you are posting from xp you might try:
for %%A in (VAR1 VAR2) do if defined %%A set "%%A="
HTH
Matthias
Interesting observation - but not quite accurate.
set var=
will set ERRORLEVEL to 1 IF var undefined, but leave ERRORLEVEL unchanged if
var is defined
whereas set var=somethingelse will leave ERRORLEVEL unchanged regardless
(empirically determined)
if defined var set var=
would appear to stop the problem you appear to be encountering.
Thanks for the help.