I have the command line file below. I need to check for an empty value of a variable. I am not supplying any command line arguments.
@echo off
@set PASSWORD=
@set PORT=9001
@set command=START
if %PASSWORD% NEQ () GOTO MyLabel
:MyLabel
@set command=%command% -p%PASSWORD%
@set command=%command% -i%PORT%
@echo %command%
I tried several options such as comparing with empty parentheses (()), empty strings (""), but nothing seems to work. It gives me the following output when it runs:
() was unexpected at this time.
I am using Windows 7 x32. Can anyone please help?
The following should do it:
For more info, see ss64.com.