I've tried writing a simple batch file you can see below:
@echo off
title test file
:menu
set /p foo = Select option (1, 2, 3):
if foo == 1 goto one
if foo == 2 goto two
if foo == 3 goto three
:one
echo One!
goto menu
:two
echo Two!
goto menu
:three
echo Three!
goto menu
Writing any of the given options writes "One!" to screen and returns the user back to the menu label. I suspect the error is with the types of variable I am declaring, although I wouldn't know, since I'm new to Batch... Any help?
=fromset /p foo=Select..and changedfoo == 1with%foo% equ 1it will work, besides the concern that you still need to work around the fact that a person can still type any other character which you do not cater for at this point.choicehas that built-in and only the characters defined can be selectedset /Pand how to get it safe and how easy a choice menu can be coded using commandchoiceas demonstrated also by the answers already written here.