|
Answer» Hi, Batchmaniac800 here. I am making a simple batch quiz for fun, but I can't figure out the command to make any input besides the one I specified to make you stay on the menu. I think it's the "if not start goto MENU", but i'm not really sure. I TRIED it but it didn't work. Can ANYONE please give me the command? I have underlined the PART I have trouble with. Here is my start:
:MENU @echo off cls echo Welcome the the math quiz echo To begin, type start and press enter. set /p input=cmd? if %input%==start goto LOAD if not start goto MENUJust use goto MENU after the if %input%==start statement. That way if it ever fails the if statement it will go back to the menu. No need to do a SECOND if not check.
Code: [Select]:MENU @echo off cls echo Welcome the the math quiz echo To begin, type start and press enter. set /p input=cmd? if %input%==start goto LOAD goto MENUWith the EXTRA quotes you can include poison characters and also use two or more word inputs. The /i makes the test case insensitive so if they type START, Start, or start they will all work.
Code: [Select]:MENU @echo off cls echo Welcome the the math quiz echo To begin, type start and press enter. set /p "input=cmd? " if /i "%input%"=="start" goto LOAD goto MENU
|