SkillAgentSearch skills...

Uncap

Map Caps Lock to Escape or any key to any key

Install / Use

/learn @susam/Uncap
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Uncap

Map Caps Lock key to Escape key, or any to any key, on Windows systems.

Download [MIT License][L] Twitter

Apart from documenting how Uncap works on Windows, this README contains detailed documentation about how to remap keys on Linux and Mac as well.

Contents

Features

The following list briefly describes some of the features of Uncap.

  1. Map Caps Lock key to Escape key on a new Windows system with almost no effort. Just download and double-click. This is the primary reason why Uncap was written. This tool was written for users of vi/Vim editor who like to map their Caps Lock key to Escape key for convenience.
  2. Map any key to any key, multiple keys to other keys, or disable keys using command line arguments. No additional file or script is required.
  3. Enable, disable or modify key mappings without having to reboot the Windows system.
  4. Disable key mappings easily by stopping Uncap.
  5. It is a single-file executable. It is very lightweight. The executable is only about 100 KB in size. It occupies less than 1 MB of memory and negligible CPU while running.

There are several other methods and tools available on Windows to map one key to another. But none of them seem to have all five features enumerated above. For example, editing Scancode Map registry value requires the Windows system to be rebooted after every change. On the other hand AutoHotkey requires an additional script file to be written. Therefore, Uncap was written to support all five features described above.

Get Started

Uncap is a single-file executable: uncap.exe.

The simplest way to run it is to download it and double-click it. No output window is displayed. It runs in background. Once it is running, whenever Caps Lock key is pressed, it is translated to the Escape key by Uncap.

Custom Mapping

It is possible to override the default mapping of Caps Lock key to Escape key by specifying a custom mapping, however to do so, Uncap must be run with arguments either from Command Prompt or from Windows Run dialog box. The following steps show how uncap.exe may be used to map Caps Lock key to Left Control key.

  1. Copy uncap.exe to a directory specified in the Windows PATH variable. C:\Windows is a very convenient location to copy this file to.

  2. Launch Windows Run dialog box by pressing Windows Logo Key + R.

  3. Enter the following command.

    uncap 0x14:0xa2
    
  4. Press OK button. This would launch Uncap. No output window would be displayed. Uncap would run in background. Whenever Caps Lock key is pressed now, Uncap would translate it to Left Control key.

  5. To terminate Uncap, run the following command.

    uncap -k
    

In the above steps, Caps Lock key is mapped to Left Control key by specifying 0x14:0xa2 as an argument to Uncap. The virtual-key code of Caps Lock is 0x14 and the virtual-key code of Control key is 0xa2. Therefore, the argument 0x14:0xa2 maps Caps Lock key to Control key.

The list of virtual-key codes for every key can be found at https://msdn.microsoft.com/library/windows/desktop/dd375731.aspx.

Usage

When Uncap is run without any arguments, it maps Caps Lock key to Escape key. It may be run with arguments to map Caps Lock key to any key, any key to any key, or disable any key.

Each argument is a colon separated pair of virtual-key codes from https://msdn.microsoft.com/library/windows/desktop/dd375731.aspx.

The virtual-key code may be specified either as hexadecimal integer as mentioned in the above URL or its equivalent decimal notation. These details are illustrated in the list of examples below.

  1. Map Caps Lock key to Escape key.

    uncap
    
  2. Swap Caps Lock key with Escape key.

    uncap 0x1b:0x14
    

    Caps Lock key is already mapped to Escape key by default. The above command maps Escape key to Caps Lock key, thus effectively swapping both keys.

  3. The hexadecimal integer is case-insensitive, so the following command is equivalent to the previous command.

    uncap 0x1B:0x14
    
  4. The virtual-key codes may be specified in decimal notation, so the following command is equivalent to the previous command.

    uncap 27:20
    
  5. Map Caps Lock key to Left Control key.

    uncap 0x14:0xa2
    
  6. Swap Caps Lock key and Left Control key.

    uncap 0x14:0xa2 0xa2:0x14
    

    This example shows that it is possible to specify more than one argument to map multiple keys to other keys.

  7. Here is another example that maps multiple keys to other keys. The following command maps Caps Lock key to Left Control key, Left Control key to Escape key and Escape key to Caps Lock key.

    uncap 0x14:0xa2 0xa2:0x1b 0x1b:0x14
    
  8. If a key is mapped to itself, then no mapping occurs for it. This may be used to override default behaviour of mapping Caps Lock key to Escape key and leave it unmapped while mapping another key to some key. Here is an example that unmaps Caps Lock key and maps F1 key to escape key.

    uncap 0x14:0x14 0x70:0x1b
    

    When a key is mapped to another key, and that key is pressed, Uncap translates it to the key it is mapped to by synthesizing a new keystroke and injecting it into the system. But when a key is mapped to itself, and that key is pressed, it is ignored, thus no translation or synthesis of a new keystroke occurs.

  9. If a key is mapped to 0, then the key is disabled. Here is an example that disables Caps Lock key completely.

    uncap 0x14:0
    
  10. Uncap runs without displaying a console by default. To terminate another instance of Uncap that may be running, use the -k or --kill option.

    uncap -k
    

    The above command kills all other instances of Uncap that are running with or without a console.

  11. To run Uncap with a console, use the -c or --console option.

    uncap -c
    

    When Uncap is running in a console like this, it may be terminated by pressing Ctrl + C.

  12. To run Uncap in debug mode, use the -d or --debug option.

    uncap -d
    

    The debug output contains one line of output with details about every press of a key or release of a key.

  13. To log the keystroke details to a file, use the -f or --file option.

    uncap -f C:\keys.txt
    

    With this option alone, Uncap runs in background and logs the keystroke details to the specified file. This option may be combined with -c or -d to run Uncap in a console or print debug output on the console, respectively.

  14. See the complete usage details along with options supported.

    uncap -h
    

Known Issue with Microsoft Edge on Windows 10

When Uncap is downloaded using the Microsoft Edge web browser on Windows 10, it sometimes fails to map keys.

The following measures have found to be unsuccessful in resolving the issue:

  • Right clicking uncap.exe, then selecting Properties, then selecting Unblock, and then clicking OK does not resolve the issue.

  • Right clicking uncap.exe, then selecting Properties, then going to Security tab, then clicking Edit, and then removing the following two accounts does not resolve the issue:

    Unknown Account(S-1-15-2-3624051433-2125758914-1423191267-1740899205-1073925389-3782572162-737981194)
    Unknown Account(S-1-15-3-3624051433-2125758914-1423191267-1740899205-1073925389-3782572162-737981194)
    

    These accounts are added automatically to files downloaded with Microsoft Edge.

The following workarounds have been found to resolve the issue successfully:

  • Copy uncap.exe to a new file in the same directory. The new file when run remaps keys successfully. Finally, delete the downloaded uncap.exe, then rename the new file to uncap.exe, and use it normally.

  • Copy uncap.exe to some other directory. The new copied file when run remaps keys successfully.

This issue was observed with Microsoft Edge Microsoft Edge 44.17763.1.0 on Windows 10 Pro.

Alternatives

There are other tools and methods available to map one key to another on Windows, Linux and Mac. This section describes a few such tools and methods.

Windows: Scancode Map registry value

One way to map a key to another key in Windows without using any additional software is by editing the registry to add a value called "Scancode Map" in "HKLM\SYSTEM\CurrentControlSet\Contr

Related Skills

View on GitHub
GitHub Stars1.2k
CategoryDevelopment
Updated1d ago
Forks47

Languages

C

Security Score

100/100

Audited on Mar 31, 2026

No findings