lundi 5 mars 2018

Batch "if" statement not working

I seem to have a problem with my "if" statements. Currently after the pause in "start" the file just closes and nothing else happens. Chances are, I have no idea what I'm doing.

@echo off

set startnum=0
goto start

:start
pause
set startnum="!startnum!"+1
if "%startnum%"="%0%" goto fail
if "%startnum%"="%1%" goto success
goto start

:success
cls
echo It worked!
echo "%startnum%"
pause.
exit

:fail
cls
echo Failure
pause.
exit

Aucun commentaire:

Enregistrer un commentaire