Skip to content

Windows NT/2000/XP/Vista?

  • From Chris McMahon. To make CapsLock a Control key (leaving your original control keys as they were), use this registry file:

    bash
    REGEDIT4
    
    [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

    To swap CapsLock and the left Control key, use:

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

    Save these as files with a .reg extension, and double-click on them in Explorer, or “run” them from a command prompt to have them update your registry (you may need to reboot).

  • Shane Holder gives some background on how "Scancode Map" is used by the system:

    bash
    It's a binary value that lets you map keystrokes in the low-level keyboard
    drivers in NT.  As a result you don't have to worry about applications
    bypassing mappings that you've done at a higher level (i.e., it just works).
    
    Here's the format of the value:
    
    	DWORD:	0x00000000	header
    	DWORD:	0x00000000	header
    	DWORD:	length (in DWORDs) of remaining data, including terminating DWORD
    	DWORD:	mapping 1
    	...
    	DWORD:	mapping n
    	DWORD:	0x00000000	terminating null DWORD
    
    Each mapping DWORD  has two parts: the input scancode, and an output
    scancode.  To map scancode 0x1d (left control) to scancode 0x3a (caps
    lock), you want a value of 0x003a001d.  Note that this does not swap the
    keys.  Using just this mapping value, both the left control and the caps
    lock key will behave as caps-lock.  To swap, you also need to map 0x3a to
    0x1d, using 0x001d003a.
    
    This registry value is system wide, and can't be made user-specific.  It
    also only takes affect on reboot.
  • Ulfar Erlingsson has provided a registry file that sets the CapsLock key to be a Control key and the Windows key to be an Alt key:

    bash
    REGEDIT4
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,38,00,5b,e0,00,00,00,00