Arrow keys

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Zai1208
Posts: 3
Joined: 20 Aug 2020 16:11

Arrow keys

#1 Post by Zai1208 » 20 Aug 2020 16:20

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 ¯\_(ツ)_/¯
Last edited by Zai1208 on 21 Aug 2020 17:31, edited 1 time in total.

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Arrow keys

#2 Post by dbenham » 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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Arrow keys

#3 Post by aGerman » 21 Aug 2020 07:26

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

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Arrow keys

#4 Post by ShadowThief » 21 Aug 2020 07:27

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.

Zai1208
Posts: 3
Joined: 20 Aug 2020 16:11

Re: Arrow keys

#5 Post by Zai1208 » 21 Aug 2020 17:26


dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Arrow keys

#6 Post by dbenham » 21 Aug 2020 20:35

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

Post Reply