An example:
@echo off color f0 cls @echo off setlocal title Guessing Game Small Version :startggs cls set /A MyNumber="(%Random% %%1000) + 1" set /A NumGuess=0 echo You have to guess a number in the range 1 to 1000 echo I will for each guess tell you if the number is to small echo or to large echo. :Nextggs set /P Guess="Enter a number> " set /A NumGuess+=1 if %Guess% EQU %MyNumber% goto :Winggs if %Guess% LSS %MyNumber% echo Your number is to small if %Guess% EQU 815 goto :winggs if %Guess% GTR %MyNumber% echo Your number is to large if /I %guess%==back goto :1 if %guess%==back goto :1 goto :Nextggs :Winggs echo Congratulations you guessed the numer in %NumGuess% tries set /P Answer="Do you want to try again [y/n]> " if [%Answer%]==[y] goto :startggs if {%Answer%}=={n} goto :1