Quick Links

A few small harmless pranks between friends is one thing, but what do you do when you are the victim of a prank that turns the key mapping for your keyboard into a complete train wreck? Today's SuperUser Q&A post has the answers that a frustrated reader needs to deal with his keyboard woes.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

Photo courtesy of midiman (Flickr).

The Question

SuperUser reader Google Services wants to know how to reset his keyboard's mapping after a friend's April Fool's Day prank completely messed it up:

My friend/enemy switched the mapping for the keys on my keyboard as an April Fool's Day joke. When I press Y, Z appears on the screen. Some keys still function properly such as B, X, G, I, D, and a few others. Also, when I press Ctrl, it functions as the Enter key. Even the function keys have been switched around!!

I called a technician, but even he was unable to find the problem and told me that reinstalling the operating system was the only way to go. I really do not want to resort to calling my friend and asking him how to undo it.

I am using Windows 7 Professional 64-bit and thankfully, at least, there is no problem with my mouse. Can you help me?

How do you reset a keyboard's mapping after an April Fool's Day prank wrecks it?

The Answer

SuperUser contributors RJFalconer and Ben N have the answer for us. First up, RJFalconer:

In this case, it sounds like a different keyboard layout has been set as the default (i.e. German, since that would cause a swap between Y and Z).

You can change your keyboard's layout via the Control Panel:

  1. Clock, Language, and Region
  2. Region and Language
  3. Keyboards and Languages Tab -> Change Keyboards

Press Alt+Shift to switch keyboard layouts.

However, this does not explain the problem with the function keys. It is possible to arbitrarily remap keys via the registry. I think you will need a third-party tool to fix this (SharpKeys, for example).

Remember, you can also use the On Screen Keyboard to type with your mouse (Start Menu\Programs\Accessories\Ease of Access\On Screen Keyboard).

Followed by the answer by Ben N:

If you do not want to use third-party applications to reverse the SharpKeys modifications, you can cut out the middleman and edit the Registry directly.

Open the Registry Editor by navigating to C:\Windows\regedit.exe in Windows Explorer. Once it is open, navigate here:

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

If there are entries named Scancode Map or Value Scancode Map, delete them. Those entries are what causes Windows to remap incoming key presses from the keyboard.

Once you are done deleting them, restart your computer. Key mappings will be reset to their default settings. You can accomplish all of this with your mouse only and no keyboard.

References for the IDs

Main.cs in the SharpKeys Source Code

How to Disable the Insert Key in Windows [WikiHow]


Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.