dimanche 26 mars 2017

Error using IF statement in Batch Files (Windows)

I am trying to use IF statement in the below code.

@echo off
SET a=
SET b=HELLO WORLD
echo %b%
if [%a%] == [] echo "String A is empty"
if [%b%] == [] echo "String B is empty" 

I am getting the output as below

HELLO WORLD
"String A is empty"
WORLD] was unexpected at this time.

Why is WORLD] was unexpected at this time. appearing in the output. Can you please point out the error? Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire