Where to find windows keyboard scancode registry information?

41,161

Solution 1

UPDATE: I found a more complete list of scan codes:

https://docs.google.com/spreadsheets/d/1GSj0gKDxyWAecB3SIyEZ2ssPETZkkxn67gdIwL1zFUs/edit#gid=0

Credits to it's author: Taran Van Hermit


I found this guide to help others understand how to remap keys using registry: https://isenselabs.com/posts/keyboard-key-kills-and-remaps-for-windows-users

But you already know how to do that, and you just need to have a list of scancodes, so here goes:

   SC Key   SC Key   SC Key        SC Key        SC Key       SC Key
            20 D     40 F6         60 Ctrl F3    80 Alt 9     A0 Alt Dn Arrow
   01 ESC   21 F     41 F7         61 Ctrl F4    81 Alt 0     A1 Alt PgDn
   02 1     22 G     42 F8         62 Ctrl F5    82 Alt -     A2 Alt Ins
   03 2     23 H     43 F9         63 Ctrl F6    82 Alt =     A3 Alt Del
   04 3     24 J     44 F10        64 Ctrl F7    84 Ctrl PgUp A4 Alt / (num)
   05 4     25 K     45 Num Lk     65 Ctrl F8    85 F11       A5 Alt Tab
   06 5     26 L     46 Scrl       66 Ctrl F9    86 F12       A6 Alt Enter
                        Lk                                       (num)
   07 6     27 ; :   47 Home       67 Ctrl F10   87 SH F11        
   08 7     28 ' "   48 Up Arrow   68 Alt F1     88 SH F12        
   09 8     29 ` ~   49 Pg Up      69 Alt F2     89 Ctrl F11      
   0A 9     2A L SH  4A - (num)    6A Alt F3     8A Ctrl F12      
   0B 0     2B \ |   4B 4 Left     6B Alt F4     8B Alt F11       
                        Arrow
   0C - _   2C Z     4C 5 (num)    6C Alt F5     8C Alt F12       
   0D = +   2D X     4D 6 Rt Arrow 6D Alt F6     8C Ctrl Up       
                                                    Arrow
   0E BKSP  2E C     4E + (num)    6E Alt F7     8E Ctrl -        
                                                    (num)
   0F Tab   2F V     4F 1 End      6F Alt F8     8F Ctrl 5        
                                                    (num)
   10 Q     30 B     50 2 Dn Arrow 70 Alt F9     90 Ctrl +        
                                                    (num)
   11 W     31 N     51 3 Pg Dn    71 Alt F10    91 Ctrl Dn       
                                                    Arrow
   12 E     32 M     52 0 Ins      72 Ctrl PtScr 92 Ctrl Ins      
   13 R     33 , <   53 Del .      73 Ctrl L     93 Ctrl Del      
                                      Arrow
   14 T     34 . >   54 SH F1      74 Ctrl R     94 Ctrl Tab      
                                      Arrow
   15 Y     35 / ?   55 SH F2      75 Ctrl End   95 Ctrl /        
                                                    (num)
   16 U     36 R SH  56 SH F3      76 Ctrl PgDn  96 Ctrl *        
                                                    (num)
   17 I     37 PtScr 57 SH F4      77 Ctrl Home  97 Alt Home      
   18 O     38 Alt   58 SH F5      78 Alt 1      98 Alt Up        
                                                    Arrow
   19 P     39 Spc   59 SH F6      79 Alt 2      99 Alt PgUp      
   1A [ {   3A CpsLk 5A SH F7      7A Alt 3      9A               
   1B ] }   3B F1    5B SH F8      7B Alt 4      9B Alt Left      
                                                    Arrow
   1C Enter 3C F2    5C SH F9      7C Alt 5      9C               
   1D Ctrl  3D F3    5D SH F10     7D Alt 6      9D Alt Rt        
                                                    Arrow
   1E A     3E F4    5E Ctrl F1    7E Alt 7      9E               
   1F S     3F F5    5F Ctrl F2    7F Alt 8      9F Alt End       

The keycode that you're going to use in registry consists of two parts for example: 4B E0 which is left arrow or 0F 00 which is Tab key, in the above list you will find the first part of the key code 4B for example, the second part usually is 00 or E0 I have no idea what the second part is and I couldn't find anything on it and I'm writing this out of my own findings, do some trial and error and you will find your key.

Solution 2

@fabianroling and anyone else who can't use third-party software: the Keyboard Scan Code Specification from Microsoft has the definitions for all the scan codes. It also says the following:

Under all Microsoft operating systems, all keyboards actually transmit Scan Code Set 2 values down the wire from the keyboard to the keyboard port. These values are translated to Scan Code Set 1 by the i8042 port chip. The rest of the operating system, and all applications that handle scan codes expect the values to be from Scan Code Set 1.

So, nothing Windows-specific, just standard Set 1 codes.

Solution 3

If you want to do it the easy way, you can simply use SharpKeys, KeyTweak or similar utilities.

If you're simply after scancodes, the same programs should be able to help:

1

2
3

Share:
41,161

Related videos on Youtube

enderland
Author by

enderland

Farewell Stack Exchange. o7 to everyone I've shared labors with over these many years. Take care.

Updated on September 18, 2022

Comments

  • enderland
    enderland over 1 year

    I am in the process of remapping some keys on my Windows 7 keyboard.

    I have done the following (in a .reg file):

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00 
    

    I am interested in being able to remap other keys. However, I am having a heck of a time finding the specific scan codes to do this.

    Is there a listing of these scan codes somewhere? I've spent a fair bit of time trying to find information and other than the caps/control I cannot seem to find them. I would like a listing of all scan codes - in a format which makes sense for remapping.

    The specific keys I am interested in are:

    • Menu button (wtf windows)
    • windows key
    • alt
    • shift
    • function
    • insert
    • pause
    • nixda
      nixda over 11 years
      Does this Microsoft link help you further?
    • enderland
      enderland over 11 years
      @nixda I've seen that but it does not provide the actual scan codes to use (as best I can tell)
    • Admin
      Admin over 10 years
      Mind that in my Windows 7 64 bit Pro, [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboar‌​d Layout] is empty, no Scancode key there.
    • AuralArch
      AuralArch almost 5 years
      BTW, FYI: on very few keyboards (other than Apple's) does the Fn/function key produce any scancode. Instead, when it is pressed in combination with certain other keys a certain, unique scancode is sent as if that other key was pressed alone instead of two keys. the pause key is the one key whose scancode can not be changed in the windows registry.
  • Fabian Röling
    Fabian Röling over 5 years
    This answer doesn't actually help anyone who isn't allowed to install third party software on the current computer (like me). If I was allowed to use this program to find out scancodes, I might as well just use the program to remap keys.
  • Tom
    Tom about 4 years
    I'm extremely confused as to the how and where to input the number pairs. How do you know? Or does it not matter? Which of the 00 do you replace?
  • Shayan
    Shayan about 4 years
    It's very simple, ESC::A this code will type a every time you hit the escape key, if you want to use the scan code from my list, do this: SC01::A
  • Tom
    Tom about 4 years
    I dont think that works @shayan. It needs to be in a hex form with two characters. Your answer is incorrect. After some digging I figured it out through sharpkeys anyway, they had a perfect answer already.
  • flarn2006
    flarn2006 over 3 years
    That list doesn't contain all of the scan codes OP was asking for. It's missing the WIndows key, menu key, and possibly others.