Sign in with
Sign up | Sign in
Your question

CHOICE command error in win 95 dos

Last response: in Windows 95/98/ME
Share
January 20, 2012 12:07:08 AM

Hello,
I'm trying to write a batch file on my 95 IBM thinkpad, just to test my current programming abilities.

so far I have:
@ECHO OFF
:MENU
ECHO is this working
CHOICE /C12
if errorlevel 1 goto HELLO
if errorlevel 2 goto GOODBYE

:NOTREALLY
ECHO Not really
pause
goto MENU

:HELLO
ECHO YES 1
pause
goto MENU

:GOODBYE
ECHO yes 2
pause
goto MENU

It is supposed to as the user for a choice (1,2), if you press 1 it's supposed to say YES 1, press 2 and it should say yes 2, if it doesn't recognize the choice it's supposed to say not really.

so far, it will ask me for a choice ( it will say [Y,N]?)
but no matter what I put down, it will only say YES 1, even if I input 2 (where I want it to say yes 2).

any help with debugging this program or finding alternatives to allow users to put their input into a variable would be greatly appreciated (set /p variable= does not work in dos in my experience).

I just started trying to program things yesterday so I apologize for my ignorance on this topic.
January 20, 2012 3:55:02 AM

It should be:

CHOICE /C:12
!