I use the following PowerShell script to enable and configure the FilterKeys accessibility feature in the registry:
Set-Location "HKCU:\Control Panel\Accessibility\Keyboard Response"
Set-ItemProperty -Path . -Name AutoRepeatDelay -Value 200
Set-ItemProperty -Path . -Name AutoRepeatRate -Value 30
Set-ItemProperty -Path . -Name DelayBeforeAcceptance -Value 0
Set-ItemProperty -Path . -Name BounceTime -Value 0
Set-ItemProperty -Path . -Name Flags -Value 47
You can also configure these in regedit.exe
manually:
![regedit.exe screenshot of the Keyboard Response key, expanded](https://cdn.statically.io/img/i.sstatic.net/JpFJLca2.png)
Explanation
These values correspond to the FILTERKEYS
structure from <winuser.h>
in the win32 API:
AutoRepeatDelay
-> iDelayMSec
:
Specifies the length of time, in milliseconds, that the user must hold down a key before it begins to repeat.
AutoRepeatRate
-> iRepeatMSec
:
Specifies the length of time, in milliseconds, between each repetition of the keystroke.
DelayBeforeAcceptance
-> iWaitMSec
:
Specifies the length of time, in milliseconds, that the user must hold down a key before it is accepted by the computer.
BounceTime
-> iBounceMSec
:
Specifies the length of time, in milliseconds, that must elapse after releasing a key before the computer will accept a subsequent press of the same key.
Flags
-> dwFlags
:
A set of bit flags that specify properties of the FilterKeys feature. The following bit-flag values are defined:
Value: FKF_FILTERKEYSON
, 0x00000001
- Meaning: The FilterKeys features are on.
Value: FKF_AVAILABLE
, 0x00000002
- Meaning: The FilterKeys features are available.
Value: FKF_HOTKEYACTIVE
, 0x00000004
- Meaning: The user can turn the FilterKeys feature on and off by holding down the RIGHT SHIFT key for eight seconds.
Value: FKF_CONFIRMHOTKEY
, 0x00000008
- Meaning: Windows 95/98, Windows 2000: A confirmation dialog box appears when the FilterKeys features are activated by using the hot key.
Value: FKF_HOTKEYSOUND
, 0x00000010
- Meaning: If this flag is set, the computer plays a siren sound when the user turns the FilterKeys feature on or off by using the hot key.
Value: FKF_INDICATOR
, 0x00000020
- Meaning: Windows 95, Windows 2000: A visual indicator is displayed when the FilterKeys features are on.
Value: FKF_CLICKON
, 0x00000040
- Meaning: The computer makes a click sound when a key is pressed or accepted. If SlowKeys is on, a click is generated when the key is pressed and again when the keystroke is accepted.
Now, to clarify the meaning of the values I used:
AutoRepeatDelay = 200
: Once the key is considered "pressed", you must hold down the key for 200ms for it to start repeating.
AutoRepeatRate = 30
: Once the key starts repeating, Windows will repeat the key approximately once every 30ms, or 33 times per second.
- Although, in my empirical tests, I don't get quite this many repeats per second, indicating that Windows may be slower than advertised. You'll want to tweak this value a bit lower than your desired actual repeat rate to achieve what feels right for you -- in my case, my desired value is 35ms, and a value of 30 is about right.
DelayBeforeAcceptance = 0
: This keeps the "delay before acceptance" accessibility feature turned off, meaning that a key is considered "pressed" the instant you press the physical key.
BounceTime = 0
: This keeps the "bounce time" accessibility feature turned off, meaning that you can press-and-release then re-press a key in rapid succession, and have those presses register as distinct key presses.
Flags = 47
(47 in decimal is 0010 1111
in binary):
0x01 FKF_FILTERKEYSON
= 1
- This enables the feature. If this value were instead 0, none of these settings would take any effect.
0x02 FKF_AVAILABLE
= 1
- I believe this works in concert with 0x01 to enable the feature.
0x04 FKF_HOTKEYACTIVE
= 1
- This enables the "hold right-shift for 8 seconds" hotkey to toggle this FilterKeys feature.
0x08 FKF_CONFIRMHOTKEY
= 1
- This causes Windows to prompt you if the hotkey is held down to enable the feature (which only happens if you first use the hotkey to turn the feature off, then use it again to turn it back on).
0x20 FKF_INDICATOR
= 1
This makes Windows display an indicator in the task bar, showing that FilterKeys is enabled. The following screenshot is from Windows 10:
![FilterKeys-enabled indicator in Windows 10 taskbar](https://cdn.statically.io/img/i.sstatic.net/EaL1nHZP.png)
This indicator is not showing up for me in Windows 11, however, indicating that it may have since been removed.
...and the rest of the Flags values are 0, or off.