0

My batchfile outputs both IF and ELSE IF...

The code goes something like this:

 @echo off

    set food=0

        if %food%== LSS 1 (
            echo You have no food.
        ) else if %food%== GTR 1 (
            echo You have %food% food!
        )
pause

Can anyone help me out?

1 Answer 1

1

You don't say what you mean by "working properly"

== lss is not a valid comparison operator. If you mean less than or equal to, use LEQ

equally, GEQ for greater than or equal to

`==` = `equ` means equal
neq means not equal
lss less
leq less or equal
gtr greater
geq greater or equal
Sign up to request clarification or add additional context in comments.

2 Comments

What made you write it in the first place? o.O
Well, I started with batch coding 2 weeks ago, and I'm not quite sure what I'm doing :P

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.