2

I'm looking for how to use Win + number shortcut to open programs using the numeric pad instead of the qwerty keys. Using Windows 10 I'm really used to having my high runner apps pinned to the task bar and use the "win + #" shortcut to open them but for some reason I can't use this with the numeric keypad numbers of the wired keyboard (numlock or not). Not sure if this is programmed behavior from windows or an actual keyboard setting. I prefer using keypad instead of qwerty numbers just because of hand placement. Any ideas hot to enable or workaround?

1 Answers1

2

This should work for plug 'n' play or built-in keyboards. Copy & paste this code into an Administrator PowerShell window (Winkey+X > Windows PowerShell (Admin)). The script is designed so that remap pairs can be easily added or subtracted. But as posted, it remaps the keys affected by Numlock (0-9, ./Del) to generate the scancodes of the corresponding QWERTY keys.


Edit#2: Reworked code -- Same result, just tighter code.

###   *** This code must be run from an elevated (Admin) PowerShell session *** ###

If both source and target are not extended scan codes,

add them here and the extended bytes will be added by code.

[Byte[]]$SimplePairs = @( 0x02, 0x4f # [1 !] => [1 end] 0x03, 0x50 # [2 @] => [2 ↓] 0x04, 0x51 # [3 #] => [3 pg-dn] 0x05, 0x4b # [4 $] => [4 ←] 0x06, 0x4c # [5 %] => [5] 0x07, 0x4d # [6 ^] => [6 →] 0x08, 0x47 # [7 &] => [7 home] 0x09, 0x48 # [8 *] => [8 ↑] 0x0a, 0x49 # [9 (] => [9 pg-up] 0x0b, 0x52 # [0 )] => [0 Ins] 0x34, 0x53 # [. >] => [. Del]

0x00, 0x3a # [Null] => [CapsLock]

).ForEach({ $_ , 0 }) ### Add zero-valued extended byte to each scancode

If either one or both are extended scan codes,

add them here with the extended byte value as well.

[Byte[]]$ExtendedPairs = @(

0x5d, 0xe0, 0x1d, 0xe0 # [ContextMenu] > [R-Ctrl]

)

[Byte[]]$AllPairs = $SimplePairs + $ExtendedPairs

[byte[]]$Remap = [byte[]]::new(8) +
[BitConverter]::GetBytes( $AllPairs.Length/4 + 1 ) + $AllPairs + [byte[]]::new(4)

$Splat = @{ 'Path' = 'HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout' 'Name' = 'ScanCode Map' 'Value' = $Remap 'Force' = $True } [Void]New-ItemProperty @Splat

echo @'

*** Done. Computer must be restarted *** *** before changes will take effect. ***

'@

Once pasted, press to execute & then restart the computer.


Edit: Undo:

Using RegEdit, delete the ScanCode Map entry (type: REG_BINARY) from the registry key:

  • HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout

or run this command from an Admin PowerShell console:

  • Remove-ItemProperty 'HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout' 'ScanCode Map'

Bonus tip: If you need to temporarily disable remapping or experiment with differnet remappings, rename the regisry entry to something other than ScamCode Map and restart. Values with mames other than ScamCode Map are ignored:

enter image description here

Keith Miller
  • 10,694
  • 1
  • 20
  • 35