Why does this simple Windows bat file give error "Syntax incorrect"? -


this in windows 7. here simple bat file test if parameter exists:

if [%1] equ [] (     echo no parameter given; usage: testparam <something>     exit ) else (     echo gave parameter: %1 ) 

when run (with no parameter) error message:

the syntax of command incorrect. 

can tell me wrong? many other examples have construct...

this problem caused missing quotes in echo statement missing argument

because didn't put quotes around argument, cmd see < "read input file something>" because "something>" isn't valid file name in windows, used invalid syntax

how fix problem:

echo "no parameter given; usage: testparam <something>" 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -