91

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.

5
  • 44
    Scroll lock: Why are you looking at me? Commented May 30, 2013 at 23:44
  • 4
    This 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
    – Lilienthal
    Commented Oct 21, 2015 at 21:17
  • @harrymc the vlaurie.com link is dead (now hosted by ParkLogic) Commented Jul 13, 2018 at 1:51
  • @johnvkumpf: There are heaps of such articles. Most dead links can still be found on the Wayback Machine. For this one see here.
    – harrymc
    Commented Jul 13, 2018 at 7:54
  • SharpKeys (free download from authoritative source): github.com/randyrants/sharpkeys/releases
    – caw
    Commented Feb 13, 2020 at 19:30

9 Answers 9

53

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

9
  • 4
    For 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.
    – user1931
    Commented Sep 7, 2009 at 5:58
  • Very easy to use - would be more lovely to be able to toggle the keys (enable/disable it) without deleting anything
    – Nam G VU
    Commented Feb 4, 2011 at 5:14
  • Will this allow me to swap the Fn and Ctrl key in Windows on a Macbook Pro Retina running Bootcamp? Thanks. Commented Aug 27, 2014 at 13:31
  • Do I have to run the app all the time, or is the change permanent? Commented Oct 7, 2015 at 16:04
  • The 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
    – Joe
    Commented Oct 14, 2015 at 18:19
14

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'?

6
  • 2
    This 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 Commented May 23, 2011 at 9:23
  • Well, for my case of converting a qwertz keyboard into a qwerty keyboard this does not work, because ctrl+z stays next to the t. :(
    – ANeves
    Commented Mar 1, 2014 at 17:33
  • For 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. Commented Oct 9, 2018 at 2:40
  • The 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!
    – stiv
    Commented Nov 20, 2019 at 17:35
  • I wanted to interchange my backspace and caps lock. This method doesn't work for me. Commented Oct 7, 2021 at 18:38
9

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.

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 (free and open source) https://sourceforge.net/projects/hotkeyp/ and this works! Just add action for key and its done. (After assign new action isn't default action executed.)

2

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.

1
  • 1
    The 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.) Commented Mar 2, 2017 at 18:25
2

The easiest way: The Microsoft Keyboard Layout Creator. This is an official Microsoft solution. Functionality is similar like Ukelele for OS X.

Download and instructions: https://www.microsoft.com/en-us/download/details.aspx?id=102134

0
2

For Windows 10: PowerToys

Microsoft has released an advanced application, PowerToys, that has a simple, but effective, key mapping facility. I've used it to swap my Alt and Ctrl keys; it works like a champ.

1

http://www.autohotkey.com/ can be a simpler and powerful solution. You can remap keys and create modifiers keys using scripts like

;Use Capslock as a modifier and not as capslock anymore
$*Capslock::
    Gui, 99:+ToolWindow
    Gui, 99:Show, x-1 w1 +NoActivate, Capslock Is Down
    keywait, Capslock
    Gui, 99:Destroy
    return

;Write functions for keys while capslock is beeing hold here
#IfWinExist, Capslock Is Down
    j::Down
    k::Up
    l::Right
    h::Left
    m::AppsKey
    i::Insert
    d::Delete
#IfWinExist

;Use right and left shifts to toggle capslock
RShift & LShift::
    SetCapsLockState, % (State:=!State) ? "On" : "Off"
    return

LShift & RShift::
    SetCapsLockState, % (State:=!State) ? "On" : "Off"
    return
3
  • 2
    But why all of this if something like ScrollLock::LControl is just enough for the remapping?
    – Yuuza
    Commented Apr 8, 2016 at 2:26
  • 1
    Sorry, 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.
    – Jp_
    Commented Apr 8, 2016 at 11:43
  • Re "I wanted to show the power of the tool": You could split the answer into two parts: The first part with a direct answer with the simplest solution that could possibly work and another more elaborate/comprehensive part. (But *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** without *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** "Edit:", "Update:", or similar - the answer should appear as if it was written today.) Commented Mar 17 at 3:27
0

I found one application, HotkeyP, which can do almost all of them in Windows 7 and it works without any issues when your desktop is unlocked. Also it is pretty easy to use.

The only drawback I found was it will not work when the desktop is locked, say, I come back from sleep and the computer is locked and I have loud music playing. Multimedia keyboards can mute from there itself. But with this application you need to unlock first.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .