lundi 6 juillet 2015

Arithmetics in IF statment (Batch)

I am currently learning (by myself) how to program in batch, but i have encountered a problem. I tried to run this script but somehow it isn't working:

set /a x=5
if %x%+1 equ 6 (@echo x + 1 is equal to 6)
echo [%x%+1]
echo.
pause

This is what it prints:

[5+1]

Press a key to continue...

Basically i just want to know how to do arithmetics in an if statement... Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire