How can I remap a keyboard key?
Solution 1
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.
(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)
(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.
(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.
Solution 2
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'?
Solution 3
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 column1
.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 theVK_
column, and switch it to anN
.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.
Solution 4
I have Genius KB-G235 USB keyboard (HID) and WinXP SP3. Neither of applications in previous answers didnt work for me. (Because working with PS/2 codes or not (fully) with XP).
I tried HotkeyP (freeware) http://petr.lastovicka.sweb.cz/others.html and this works! Just add action for key and its done. (After assign new action isn't default action executed.)
Solution 5
Keyman Desktop - You can even create your own custom keyboards with Keyman Developer. With keyboards for over 1000 languages, Keyman Desktop lets you type in your language even when Windows doesn’t.
Related videos on Youtube
Kasper Grubbe
Just another djork trying to ply his art in this mad mad world. Tech stack I prefer to use: Laguage: C# / .NET Core / ASP.NET Core Editors: Visual Studio / VS Code Persistence: RavenDB, SqlServer (MSSql or Postgres) Source control: Github Containers: Docker & trying to learn K&'s Cloud Platform: Azure Caching/CDN: Cloudflare Finally: A Tauntaun sleeping bag is what i've always wanted spaces > tabs
Updated on September 17, 2022Comments
-
Kasper Grubbe over 1 year
One of my laptop's keys has fallen off. Is there any way I can remap another key to serve as that key? I'll 'sacrifice' the other key because I never use it.
-
Colonel Panic almost 11 yearsScroll lock: Why are you looking at me?
-
Lilienthal over 8 yearsThis question covers permanently remapping keys. Most answers are based on a registry edit requiring a reboot. For ways to remap keys without a restart, swapping keys with each other, or swapping for specific applications, see this question: Remapping keyboard keys for specific applications
-
john v kumpf almost 6 years@harrymc the vlaurie.com link is dead (now hosted by ParkLogic)
-
harrymc almost 6 years@johnvkumpf: There are heaps of such articles. Most dead links can still be found on the Wayback Machine. For this one see here.
-
Alaa over 4 yearsSharpKeys (free download from authoritative source): github.com/randyrants/sharpkeys/releases
-
-
John T over 14 yearsFor simple remapping this is the way to go, no need to write a full blown autohotkey script. I swear by AHK don't get me wrong, but thats more for keyboard combinations rather than simple remapping.
-
Nam G VU over 13 yearsVery easy to use - would be more lovely to be able to toggle the keys (enable/disable it) without deleting anything
-
James Broadhead almost 13 yearsThis is th best solution I have found - unlike AutoHotKey and Keytweak, I can modify the characters generated with modifiers, without changing the unmodified behaviour. Now I can get ( and ) without Shift, 9 and 0 are unaffected! :D
-
Colonel Panic over 8 yearsDo I have to run the app all the time, or is the change permanent?
-
Ian Jamieson over 8 yearsThe HowToGeek registry hack link above is perfect for doing this without software -- but the scancode link in said article is dead. Here's a live (as of today) one: msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx
-
Yuuza about 8 yearsBut why all of this if something like
ScrollLock::LControl
is just enough for the remapping? -
Jp_ about 8 yearsSorry, I really could simplify, but I wanted to show the power of the tool. With this script you don't need to sacrifice keys, you just need to have a modifier key and have a second function for one key.
-
Avatar over 7 yearsI am using two different USB keyboards the same time, working multilingual. One of my keyboards has a disturbing layout for INS, END, DEL, ... that I wanted to change. Needing to reboot everytime I change the keyboard is not a solution. Then probably Autohotkey is. Need a simple on-off-switch. Or I just get used to SHIFT + NumKeys...
-
Anton Daneyko over 7 yearsIt seems my custom mapping was reset after a Windows update. Did anyone had this issues?
-
agaragaragar over 7 yearsSeems like this doesnt support remapping to Alt Gr.
-
Jukka K. Korpela about 7 yearsThe Keyman software is becoming free after SIL International bought it. This makes it a more interesting choice than before. (Few people would buy software to do just a simple mapping of a key for personal use.)
-
David Sopko over 5 yearsFor some applications that (presumably) are listening to keydown events it is also necessary to also remap keyboard scan codes. It's a nice solution because it's built into windows and you can use the windows shortcuts.
-
stiv over 4 yearsThe only problem is that it requires .NET Framework 2.0 - if you install it to run the keyboard layout creator, make sure you uninstall it after!
-
Black Chase over 2 yearsI wanted to interchange my backspace and caps lock. This method doesn't work for me.