batch file - String check incorrectly returning true -


so have been playing around in batch trying make simple batch game.

so have done wrong?

here code:

:promotions_sucessful cls if %division%==bronze v ( set league=bronze iv set lp=0 echo have been promoted! del promotion.txt pause>nul goto menu ) if %division%==bronze iv ( set league=bronze iii set lp=0 echo have been promoted! del promotion.txt pause>nul goto menu ) 

so if division set bronze iv goto bronze v why? can explain i've done wrong , should change.

i can supply more information if required.

you need use quotes in if-statements:

:promotions_sucessful cls if "%division%"=="bronze v" ( set league=bronze iv set lp=0 echo have been promoted! del promotion.txt pause>nul goto menu ) if "%division%"=="bronze iv" ( set league=bronze iii set lp=0 echo have been promoted! del promotion.txt pause>nul goto menu ) 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -