1.

Solve : choice input?

Answer»

When I use the CHOICE option my program works , I just needed to change it with the SET command

When I use it on NT, it says that it doesn't recognize the command...

Is there any other solution for the CHOICE command or do I use a wrong syntax:

This is what I use:
CHOICE /N /C:123 PICK A NUMBER (1, 2, or 3)%1

IF ERRORLEVEL ==3 GOTO THREE
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
GOTO END
:THREE
ECHO YOU HAVE PRESSED THREE
GOTO END
:TWO
ECHO YOU HAVE PRESSED TWO
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
:END

Please can someone PROVIDE me with some feedback

Big THANKS,
WizzyFor whatever reason, Microsoft discontinued CHOICE on NT machines. For better or WORSE they added the /p switch to the SET command:

Code: [Select]
set /p var=PICK A NUMBER (1, 2, or 3)
if %var=1 goto one
if %var=2 goto two
if %var=3 goto three
GOTO END
:THREE
ECHO YOU HAVE PRESSED THREE
GOTO END
:TWO
ECHO YOU HAVE PRESSED TWO
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
:END


Hope this helps. It looks very nice and works for XP but still not in NT

I truly had a bad day yesterday. Not only is the code posted wrong (incomplete) but you're right, the /p switch didn't show up until W2K.

If you have access to a Win9x machine you can borrow a copy of CHOICE or you can get it from the MS-DOS 6.22 Supplemental Disk

Good luck. I copied a choice.com file from a Win95 PC and...

...YOEHOE it's working...




Thanks a lot SideWinder !!



Discussion

No Comment Found