How can I remap a keyboard key?

Here is a good article from Howtogeek about using a utility called SharpKeys:

##Map Any Key to Any Key on Windows 10, 8, 7, or Vista If you are tired of the way certain keys on your system work, such as the Caps Lock key, you can re-map them to function as a different key by using a registry hack. But there should be an easier way, right?

This is where SharpKeys comes into the picture: It’s a small utility that will let you easily map one key to another key easily, or even turn the key off, without having to enter the registry at all.

For instance, I used the key mapping to just turn off my Caps Lock key, since I never use it.

image
(source: howtogeek.com)

You can click the Add button to bring up the Add New Key Mapping dialog, where you can either select the keys to map from the lists, or just click the Type Key button and press the key manually (which I find much more intuitive)

image
(source: howtogeek.com)

Once you are done, click the Write to Registry button and you’ll be told to log off or reboot for the changes to take effect.

image
(source: howtogeek.com)

If you want all the technical details on how the registry keys work, you can read about how to map keys using registry hacks.

Link for reference


Using Microsoft Keyboard Layout Creator here without problems. For switching modifier keys I would suggest a registry hack or an application that changes the registry for you, do not use a pure software remap like AutoHotkey as those solutions don't work for every application.

Another solution is to get a replacement key in case you really can't insert the key back in your laptop, have you tried a search for 'broken laptop key'?


You can use Microsoft's Keyboard Layout Creator.
This will even allow you to add extra functionality to your keyboard, such as changing a key into a dead key (e.g. ~), add extra mappings (e.g. altgr+c ->ç), etc.

In order to edit the special keystrokes, like ctrl+FOO, you might need to edit the .klc file manually.
You can find instructions by @Senseful in https://superuser.com/a/172993/157884 :

You need to modify the .klc file manually.

Basically you just modify the VK_ column to match the value in column 1.

So for example if you want to bind L to N, you would create the keyboard as you normally would in KLC. Then you would open the KLC file in a text editor. Find the value L in the VK_ column, and switch it to an N.

For more information, I wrote the complete steps on my blog.

Warning: incomplete support for key bindings in some applications

However, be warned that some applications might not take those special keystrokes properly.

As an example: with my particular configuration, pressing altgr+a in DotA2's teamchat will erase the text — instead of adding an ã like in other applications.