Skip to content

Numeric input not accepted by choice.exe #3608

@pasccom

Description

@pasccom

I discovered that choice.exe does not accept numeric input in Terminal whereas it does in the old Windows Console. I am on Windows 10 (update 19.03).
I wrote the following MWE:

@echo off

:_menu
cls
@echo Choose:
@echo   (1) Chocolate
@echo   (2) Vanilla
@echo   (S) Strawberry
@echo   (Q) Quit
@echo.

set _CHOICEOPTS_=q12s

rem -- Choice.com can't be launched in x64 environment ; use builtin "choice.exe" command
if exist %SystemRoot%\system32\choice.exe (
    choice.exe /n /c %_CHOICEOPTS_% /M "Your choice : "
)else (
    choice /n /c:%_CHOICEOPTS_% "Your choice : "
)

set /A _choice_=%ERRORLEVEL%-1
GOTO _menu%_choice_%


:_menu0
GOTO _exit
:_menu1
@echo You chose chocolate
pause
GOTO _menu
:_menu2
@echo You chose vanilla
pause
GOTO _menu
:_menu3
@echo You chose strawberry
pause
GOTO _menu
:_exit
exit /B 0

In Windows console, when I press 1 or 2, I get the expected output, but in Windows Terminal nothing happens (as if 1 and 2 are not accepted by choice.exe).
Could you investigate what is happening? I am ready to provide any relevant information.
Best regards.

Metadata

Metadata

Assignees

Labels

Area-InputRelated to input processing (key presses, mouse, etc.)Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Help WantedWe encourage anyone to jump in on these.Issue-BugIt either shouldn't be doing this or needs an investigation.Priority-2A description (P2)Product-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions