How to check empty value in cmd file?
Use IF DEFINED variable
without the percent signs around variable.
Tested in XP (32bit) and Win7 x64:
SET PASSWORD=
IF DEFINED PASSWORD (echo PASSWORD = %PASSWORD%) ELSE (echo PASSWORD is empty or undefined)
IF DEFINED USERNAME (echo USERNAME = %USERNAME%) ELSE (echo USERNAME is empty or undefined)
The following should do it:
if [%PASSWORD%] NEQ [] GOTO MyLabel
For more info, see ss64.com.