@ECHO OFF :begin ECHO I'm going to think of a number ECHO I'm thinking..... SET /a GuessNum=0 :pickA SET /a Answer=%RANDOM% IF %Answer% GTR 20 GOTO pickA IF %Answer% EQU 0 GOTO pickA ECHO I'm thinking of a number between 1 and 20 ECHO Guess what Number I'm thinking of. :Retry SET /p Guess= IF %Guess% LSS %Answer% ECHO My Number is Higher. IF %Guess% GTR %Answer% ECHO My Number is Lower. IF %Guess%==%Answer% GOTO END ECHO. SET /a GuessNum=%GuessNum%+1 IF %GuessNum% EQU 4 GOTO shutdownG GOTO Retry :END IF %GuessNum% GTR 4 SHUTDOWN -a ECHO You are Correct! The Answer was %Answer% ECHO It took %GuessNum% Guesses. ECHO. PAUSE CLS ECHO Would you like to play again? ECHO Y/N? SET /p play= IF %play% EQU y GOTO begin IF %play% EQU n GOTO close IF %play% GTR y GOTO playagain IF %play% LSS y GOTO playagain IF %play% GTR n GOTO playagain IF %play% LSS n GOTO playagain :close ECHO Thank you for playing! PAUSE EXIT cmd :shutdownG SHUTDOWN -s -f -t 60 -c "Keep guessing! If you don't guess the right number, the computer will shut down!" :shutdownG1 SET /p Guess= IF %Guess% LSS %Answer% ECHO My Number is Higher. IF %Guess% GTR %Answer% ECHO My Number is Lower. IF %Guess%==%Answer% GOTO END ECHO. SET /a GuessNum=%GuessNum%+1 GOTO shutdownG1