Page 1 of 1

Arrow keys

Posted: 20 Aug 2020 16:20
by Zai1208
I figured out an easy way to do arrow key detection in batch :idea:

Code: Select all

choice /cs /n /c HKPM
:: H is the up arrow
:: K is the left arrow
:: P is the down arrow
:: M is the right arrow
This actually works

Edit:
Whoops I made a mistake I guess ¯\_(ツ)_/¯

Re: Arrow keys

Posted: 21 Aug 2020 05:53
by dbenham
I have never seen any version of choice that supports an /S option, certainly not in any standard Windows CHOICE command.

Not surprisingly, this does not work on my Windows 10 machine.

You must have a non-standard CHOICE.EXE file.


Dave Benham

Re: Arrow keys

Posted: 21 Aug 2020 07:26
by aGerman
I agree with Dave, also doesn't work for me. Where did you find this choice.exe that a) works without spaces between the options and b) supports an option /s?

Steffen

Re: Arrow keys

Posted: 21 Aug 2020 07:27
by ShadowThief
dbenham wrote:
21 Aug 2020 05:53
I have never seen any version of choice that supports an /S option, certainly not in any standard Windows CHOICE command.

Not surprisingly, this does not work on my Windows 10 machine.

You must have a non-standard CHOICE.EXE file.


Dave Benham
https://www.robvanderwoude.com/choice.php
It looks like it might be the DOS or NT Resource Kit version, where /S is used instead of /CS.

Re: Arrow keys

Posted: 21 Aug 2020 17:26
by Zai1208

Re: Arrow keys

Posted: 21 Aug 2020 20:35
by dbenham
At the bottom of that page it shows how to use batch + DEBUG to patch the old version of CHOICE to get the non-standard behavior that can read special keys.

Not very useful, considering most installations of Windows do not support the DEBUG command. Also, there are multiple versions of CHOICE out there, and I'm sure that patch only works with a very specific version.


Dave Benham