Home / Remap Keys in Windows 11 with AutoHotkey v2
Remap Keys in Windows 11 with AutoHotkey v2
AutoHotkey v2 remapping examples for CapsLock, Escape and extra mouse buttons with reversible Windows 11 shortcuts.
These examples use AutoHotkey v2 on Windows 11 or Windows 10. Copy a code sample into a UTF-8 text file, save it with the .ahk extension, and run it with the v2 interpreter. Check any script from an unfamiliar source before executing it.
Turn CapsLock into Escape
CapsLock::EscHandy for editors. The CapsLock typing function will no longer toggle while this script is active.
Use Ctrl+Alt+K for a shortcut
^!k::Send "Hello"Change the sample output before use; the key combination only works while the script is running.
Map a side mouse button
XButton1::Browser_BackMouse side buttons depend on device drivers and the hardware actually reporting XButton1.
Limits and safety checks
Put remaps in a separate test .ahk script first. Exit the script from the notification area to restore normal key behavior. An administrator-only application may ignore non-elevated scripts.
Frequently asked questions
Does this run on Windows 11?
Yes, AutoHotkey v2 supports Windows 11 and Windows 10 for desktop automation; individual apps can impose their own limitations.
Is AutoHotkey v1 syntax compatible with v2?
Not always. AutoHotkey v2 changes many commands and expressions; use v2 examples with the v2 interpreter.
More AutoHotkey resources
Download AutoHotkey v2 · AHK key names · Hotkey not working · Migrate v1 to v2