but it doesn't work, it's invalid if statement
This one is tricky - it took a minute to figure out. Even though it
appears that the blank condition of the replaceable parameter, %1, is
being tested; the syntax of the second part of your compound statement
is being parsed, anyway. This is because the command processor is a
single pass processor and the parentheses make the multiple lines a
single statement (all of which is evaluated at one time). Therefore,
if %1 is empty, a syntax error results.
Try something like this ...
if not (%1) == () (
if not [%1] == [""] (set SENDER=%1))
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
What are you trying to determine by the condition?
... I can guess of course, but I'd like to make sure I'm not incorrectly
inferring your goal.
--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l
thanks for you help, i'm trying to make sure the parameter that passed
to my batch file isn't empty nor ""
try this, then:
if "%~1" EQU "" (
echo/first parameter is either empty (null, missing) or ""
) else (
echo/an actual non-null value was passed as the first parameter.
)
This can sometimes be useful too:
(set _param=%~1)
if defined _param (
echo/an actual non-null value was passed as the first parameter.
) else (
echo/first parameter is either empty (null, missing) or ""
)
/Al