created October 29, 2002 · complexity basic · author Jacques Petit · version 5.7
On Windows systems, you can edit the registry to change the code produced when a key is pressed. This tip shows how to change the keyboard layout so that the CapsLock key acts as a Ctrl key.
Contents |
Replacing CapsLock with Ctrl
Place the following text into a text file with the extension *.reg and update your registry by double-clicking the file:
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
You will probably need to reboot your machine for this system change to take effect.
Undoing the change
The verified way to reverse this setting is to delete the new scan codes key that was added.
(tested this on one of my machines)
Swapping keys rather than replacing CapsLock
The registry entry above sets CapsLock to Ctrl. The following registry entry swaps the CapsLock and Ctrl keys on your keyboard. Useful if you sometimes use CapsLock.
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
Setting the key layout for the current user
If the machine has multiple users who might not like the new layout, instead of using [HKEY_LOCAL_MACHINE\....] you can specify [HKEY_CURRENT_USER\Keyboard Layout]. This will make the changes for one user account only. Additionally, simply logging off and back on will apply the changes (no need to reboot).
Comments
Some explanation is here.
A more detailed explanation and reference can also be found here.