Uncap
Map Caps Lock to Escape or any key to any key
Install / Use
/learn @susam/UncapREADME
Uncap
Map Caps Lock key to Escape key, or any to any key, on Windows systems.
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
- Get Started
- Custom Mapping
- Usage
- Known Issue with Microsoft Edge on Windows 10
- Alternatives
- Resources
- License
- Support
Features
The following list briefly describes some of the features of Uncap.
- 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.
- 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.
- Enable, disable or modify key mappings without having to reboot the Windows system.
- Disable key mappings easily by stopping Uncap.
- 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.
-
Copy
uncap.exeto a directory specified in the WindowsPATHvariable.C:\Windowsis a very convenient location to copy this file to. -
Launch Windows Run dialog box by pressing
Windows Logo Key+R. -
Enter the following command.
uncap 0x14:0xa2 -
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.
-
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.
-
Map Caps Lock key to Escape key.
uncap -
Swap Caps Lock key with Escape key.
uncap 0x1b:0x14Caps 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.
-
The hexadecimal integer is case-insensitive, so the following command is equivalent to the previous command.
uncap 0x1B:0x14 -
The virtual-key codes may be specified in decimal notation, so the following command is equivalent to the previous command.
uncap 27:20 -
Map Caps Lock key to Left Control key.
uncap 0x14:0xa2 -
Swap Caps Lock key and Left Control key.
uncap 0x14:0xa2 0xa2:0x14This example shows that it is possible to specify more than one argument to map multiple keys to other keys.
-
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 -
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:0x1bWhen 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.
-
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 -
Uncap runs without displaying a console by default. To terminate another instance of Uncap that may be running, use the
-kor--killoption.uncap -kThe above command kills all other instances of Uncap that are running with or without a console.
-
To run Uncap with a console, use the
-cor--consoleoption.uncap -cWhen Uncap is running in a console like this, it may be terminated by pressing
Ctrl+C. -
To run Uncap in debug mode, use the
-dor--debugoption.uncap -dThe debug output contains one line of output with details about every press of a key or release of a key.
-
To log the keystroke details to a file, use the
-for--fileoption.uncap -f C:\keys.txtWith this option alone, Uncap runs in background and logs the keystroke details to the specified file. This option may be combined with
-cor-dto run Uncap in a console or print debug output on the console, respectively. -
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.exeto a new file in the same directory. The new file when run remaps keys successfully. Finally, delete the downloadeduncap.exe, then rename the new file touncap.exe, and use it normally. -
Copy
uncap.exeto 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
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
