Sid
Sid

Reputation: 645

Unable to compare two strings in .bat file

Hi I'm facing a strange issue, i'm unable to compare two strings in a .bat file

set mvalue="Yes"
echo %mvalue%

echo %MailAlert%


IF  %MailAlert% == %mvalue% (

    echo "hello world"
} 

value of %MailAlert% is Yes it will be recieved from a java code and i'm printing it by using echo command and is displaying Yes.

But i dont know why i'm unable to compare those two strings.

Please help me out.

Upvotes: 0

Views: 128

Answers (1)

aphoria
aphoria

Reputation: 20209

Is the value of %MailAlert% just Yes? Because the value of %mvalue% is "Yes". So, you are comparing IF Yes == "Yes" which is false.

Also, your closing } should be a ).

Upvotes: 1

Related Questions