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

php - How can an email be returned from Stripe Checkout? -

SQL php on different pages to Insert (mysqli) -

linked list - Get the index of the Node in a LinkedList which contains the given value in java -