.ahk

How to Open AHK File: Run, Edit and Check AutoHotkey Scripts

An AHK file is a plain-text AutoHotkey script for Windows. To open an AHK file and run it, install the free AutoHotkey v2 from autohotkey.com and double-click the file; to read or change it, right-click it and choose Edit script or open it in Notepad. Before you open AHK files from someone else, drop them into the free checker below: it shows every hotkey and flags risky commands without running anything.

Category: Script (plain text) Program: AutoHotkey Platform: Windows only Current version: AutoHotkey v2 (v1.1 is legacy)

Open AHK File Online: View Script, Hotkeys & Risky Commands (Free)

Open AHK files here without installing anything: drop an .ahk file below to read it safely. The viewer shows the script with syntax highlighting (read-only, it is never executed), tells you whether it's written for AutoHotkey v1 or v2 and why, translates every hotkey such as ^j:: and hotstring such as ::btw:: into plain English, and flags commands that can change your PC, like Run, FileDelete, RegWrite, DllCall, Download or ComObject, with an explanation of each. It's a static text check, not an antivirus scan.

🔒 Nothing is uploaded — your file never leaves this device

What is an AHK file?

An AHK file is a plain-text script written for AutoHotkey, a free, open-source automation program for Microsoft Windows. The script tells AutoHotkey what to do: remap keys, type a phrase when you enter an abbreviation, click buttons, move windows or launch programs. The file itself is ordinary text you can read in Notepad; nothing happens until AutoHotkey runs it. That's why there are two ways to open AHK files: run them with AutoHotkey, or open them as text to read or edit.

AutoHotkey was first released in November 2003 by Chris Mallett and is licensed under the GPLv2. Two incompatible generations of the language exist. AutoHotkey v2 (v2.0 released December 20, 2022) has been the official primary version since January 22, 2023. AutoHotkey v1.1 is now legacy: its final update was published in March 2024. Many scripts you find in old forum posts and tutorials are still v1, which is why "this script requires AutoHotkey v1/v2" messages are so common.

A typical script is just a few lines. This one makes Ctrl+J show a message and expands "btw" as you type:

#Requires AutoHotkey v2.0
^j::MsgBox "Hello!"        ; Ctrl+J shows a message box
::btw::by the way           ; typing btw + space types "by the way"
How an AHK file is used A text .ahk script is either run by AutoHotkey on Windows, where the launcher picks v1 or v2, or compiled by Ahk2Exe into a standalone .exe. Reading it in a text editor or in this page's viewer never runs it. script.ahk plain text AutoHotkey (Windows) launcher reads #Requires and picks v2 or v1 Hotkeys, text shortcuts, window and file actions Ahk2Exe compiles to standalone .exe Read only (safe) Notepad, VS Code or the viewer on this page
Illustration: an .ahk script is run by AutoHotkey, compiled to an .exe with Ahk2Exe, or simply read as text.

How to open an AHK file (quick answer)

Short answer: to open AHK files, run them with AutoHotkey on Windows, or open them as text to read and edit them. Do this:

  1. Read it first. Drop the file into the viewer above or right-click it > Open with > Notepad. Check what the hotkeys do and whether anything is flagged.
  2. Install AutoHotkey. Download the v2 installer from autohotkey.com (the official site) and click Install. Choose Current user if you aren't an administrator.
  3. Double-click the .ahk file. A green H icon appears in the notification area (bottom right): the script is running. If it was written for v1, the launcher offers to download v1 for you.
  4. Use, edit or exit it. Press its hotkeys. Right-click the tray icon to Edit Script, Reload Script or Exit.
Your situationWhat to do
Got an .ahk file and want to know what it doesUse the viewer: hotkeys and risky commands, without running it
Windows asks "How do you want to open this file?"AutoHotkey isn't installed: install v2, or pick Notepad to just read it
"Requires AutoHotkey v1, which is not installed"Click Yes to add v1 alongside v2 (details)
Error dialog with a line number when it startsUsually v1 code in v2 or vice versa (check the version)
Want to change a hotkey or textRight-click > Edit script, save, then Reload Script (how)
Want it to run every time Windows startsPut a shortcut in shell:startup (steps)
Need it on a PC without AutoHotkeyCompile it to an .exe with Ahk2Exe (how)
On a Mac, Linux, iPhone or AndroidYou can read it but not run it (alternatives)

How to run an AHK script on Windows 11 and 10

To run an AHK script you need AutoHotkey installed; Windows has no built-in support for the format, so on a new PC you can't open AHK files as programs until you add it. Install AutoHotkey v2, the current version, even if your script is old: its launcher can fetch v1 automatically when a script needs it.

  1. Go to autohotkey.com and click Download. Take the current v2 installer (named like AutoHotkey_2.0_setup.exe). Avoid download sites and look-alike repositories: the official sources are autohotkey.com and the AutoHotkey project's own GitHub page.
  2. Run the installer and click Install. Without administrator rights, select Current user; it installs to %LocalAppData%\Programs\AutoHotkey instead of Program Files.
  3. When installation finishes, the Dash opens. It's AutoHotkey's control panel (later reachable from the AutoHotkey entry in the Start menu) with New script, Compile, Help files, Window Spy, and the launcher and editor settings.
  4. Double-click your .ahk file. The script starts and its green H tray icon appears. Many scripts don't open a window at all; they just wait for their hotkeys.
  5. To stop it, right-click the tray icon and choose Exit. You may need to click the ^ arrow on the taskbar to see hidden icons.
Illustration of the right-click menu for an .ahk file after installing AutoHotkey (on Windows 11, these entries may be under "Show more options"). "Compile script" appears once the compiler is installed.

Running v1 and v2 scripts on the same PC. You don't need two separate installs. AutoHotkey v2's launcher lets multiple versions share the .ahk extension; the official guide says installing v1 and v2 into different folders "is not necessary and is currently not supported". The launcher reads the script's #Requires line, or guesses from the syntax, and starts the matching interpreter. If it can't decide, it shows a menu so you can choose.

AutoHotkey v1 vs v2: which version does your script need?

Check the first lines: #Requires AutoHotkey v2.0 means v2, and #Requires AutoHotkey v1.1 means v1. If there's no such line, the syntax gives it away. v2 removed the old "command" syntax, so v1 scripts don't run on v2 without changes, and v2 scripts don't run on v1.

Clue in the scriptv1 (legacy)v2 (current)
Message boxMsgBox, HelloMsgBox "Hello" or MsgBox("Hello")
Assigning textname = Bobname := "Bob"
Using a variable in textMsgBox, Hi %name%MsgBox "Hi " name
Context-sensitive hotkeys#IfWinActive, #If#HotIf
Typical first lines#NoEnv, SetBatchLines -1#Requires AutoHotkey v2.0
Short functions—Fat arrow: Double(x) => x * 2
StringsDouble quotes only"double" or 'single' quotes
COM objectsComObjCreate()ComObject()
Script file encodingNot UTF-8 by defaultUTF-8 by default

These are the same kinds of clues AutoHotkey's own launcher looks at: commas after command names, legacy = assignments, #NoEnv/#If versus #HotIf, single quotes and fat arrows. Hotkeys (^j::) and simple hotstrings (::btw::) look the same in both versions, so checking the version first saves trouble when you open AHK files found online. The checker shows exactly which lines point to which version.

Tip for script authors: put #Requires AutoHotkey v2.0 on the first line. The launcher then always picks the right version, and anyone who opens the file sees at a glance which AutoHotkey it needs.

Common AHK errors and how to fix them

Most errors you see when you open an AHK file come from a version mismatch: a v1 script meeting v2, or the reverse. Here are the messages you're most likely to see and what each one means.

"It looks like the script you are trying to run requires AutoHotkey v1, which is not installed."

The v2 launcher decided the script is v1 code. Click Yes to "download and install AutoHotkey v1", which keeps your v2 install working next to it. If you'd rather stay on v2 only, the script has to be converted to v2 syntax. The same message appears with "v2" if an older setup meets a v2 script.

Illustration of the AutoHotkey v2 launcher prompt for a v1 script (wording from the launcher's source code).

"#Requires AutoHotkey v2.0 … This line does not contain a recognized action."

An old AutoHotkey v1 that doesn't understand the #Requires directive is trying to run a v2 script. Install AutoHotkey v2 from autohotkey.com; its launcher then routes each script to the right version.

Error dialog pointing at a line like MsgBox, Hello or x = 5

That's v1 syntax running under v2. Add #Requires AutoHotkey v1.1 as the first line so the launcher uses v1, or rewrite the line in v2 style (MsgBox "Hello", x := 5). The reverse also happens: MsgBox("Hello") isn't valid v1.

Accented characters or emoji come out garbled

v2 reads script files as UTF-8 by default, while v1 doesn't. Save the file as UTF-8 with BOM (in Notepad: File > Save as > Encoding) so both versions read the special characters correctly.

Hotkeys don't work in some windows

Windows stops a normal script from sending keys to programs that run as administrator. If you use an administrator account, start the script with Run with UI access from its right-click menu: it can then work with admin windows without itself running as admin. Running the whole script as administrator also works, but only do that for scripts you trust.

Nothing seems to happen when you double-click

Most scripts run silently in the background. Look for the green H icon in the notification area, then try the script's hotkeys; the viewer's Hotkeys tab lists them all.

How to edit an AHK file

Any plain-text editor can open AHK files for editing. The quickest way is right-click > Edit script, which opens the file in the editor set for AutoHotkey (Notepad unless you change it in the Dash under Editor settings). After saving, right-click the script's tray icon and choose Reload Script so your changes take effect.

EditorBest forNotes
NotepadQuick changesBuilt into Windows; no highlighting. Save as UTF-8.
Visual Studio Code + AutoHotkey v2 Language Support (thqby)v2 scriptsFree extension: IntelliSense, error checking, formatting, run/debug/compile from the context menu.
Visual Studio Code + AHK++ (AutoHotkey Plus Plus)v1 and v2 scriptsFree; highlighting, debugging and formatting. Its v2 support builds on thqby's extension.
Notepad++ or any code editorGeneral editingOpens .ahk as text; highlighting depends on the editor.

Don't edit with Word or WordPad: they can save formatting or change quote characters, which breaks the script. If you just need a safe copy to send or archive, the viewer's Download as .txt button saves the script with a .txt extension so nobody can run it by double-clicking.

How to read hotkeys and hotstrings in an AHK script

Hotkeys are the lines with :: after a key, and each symbol before the key is a modifier. ^!j:: means Ctrl+Alt+J. Hotstrings start with a colon: ::btw::by the way replaces "btw" with "by the way" as you type.

SymbolMeansExample
#Win (Windows logo key)#n:: = Win+N
!Alt!t:: = Alt+T
^Ctrl^j:: = Ctrl+J
+Shift^+s:: = Ctrl+Shift+S
&Combine any two keysNumpad0 & Numpad1::
< / >Left / right key of the pair<^a:: = Left Ctrl+A
*Fires even with extra modifiers held*F1::
~Key keeps its normal function~LButton::
$Uses the keyboard hook (so Send can't retrigger it)$a::
UPFires when the key is releasedF12 up::
a::bRemap: key A acts as key BCapsLock::Ctrl

Hotstring options sit between the first two colons: :*: fires without an ending key, :?: fires inside words, :C: is case-sensitive, :X: runs code instead of typing text, :R:/:T: send raw text, :B0: keeps the abbreviation, and :O: omits the ending character. The viewer decodes all of these for you.

How to run an AHK script when Windows starts

Put a shortcut to the script in your Startup folder. That way you don't have to open AHK files by hand after every restart. This is the method AutoHotkey's FAQ recommends:

  1. Find the .ahk file in File Explorer, select it and press Ctrl+C.
  2. Press Win+R, type shell:startup and press Enter.
  3. Right-click inside the folder that opens and choose Paste shortcut.
Illustration of the Windows Run dialog (Win+R) opening the Startup folder.

The script now starts each time you sign in. To stop that, delete the shortcut from the same folder; the original script stays where it was. Using a shortcut rather than moving the file keeps edits in one place.

How to convert an AHK file to EXE (Ahk2Exe)

AutoHotkey's compiler, Ahk2Exe, turns a script into a standalone .exe that runs on PCs without AutoHotkey installed, so the people you share it with never need to open AHK files at all. The .exe contains the AutoHotkey interpreter, your script, any files it includes and any files added with FileInstall.

  1. Open the Dash (Start menu > AutoHotkey) and choose Compile. Ahk2Exe is a separate automatic download, so the first time the Dash offers to install it.
  2. Pick your .ahk file as the source, choose where to save the .exe (and, if you like, a custom icon), then start the conversion. The .exe appears in the folder you chose.
  3. Afterwards you can also right-click any .ahk file > Compile script, or use the Convert .ahk to .exe shortcut in the Start menu.

Two things to know. First, compiling is not protection: AutoHotkey's documentation notes that compression "does not prevent the source code from being extracted by tools dedicated to that purpose", so don't put passwords in a script. Second, compiled scripts trigger antivirus warnings more often than plain .ahk files, especially if they are compressed with a packer such as UPX or MPRESS (the default install doesn't include one). You can't convert an AHK file to a BAT, VBS or PowerShell file automatically; the languages are different and would need rewriting.

Is an AHK file safe to open?

Opening an AHK file as text is completely safe; running it is as risky as running any program. Viewing the file in Notepad or the checker on this page can't do anything. Once AutoHotkey runs it, though, the script has your user permissions: it can type and click for you, start programs, download files, delete data and change settings. Some malware has been written in AutoHotkey, so treat a script from an unknown source like an unknown .exe.

Before you open AHK files that came by email, chat or a forum, read them. Red flags to look for before you run a script (the checker highlights all of these):

  • Download or UrlDownloadToFile followed by Run: downloads something and starts it.
  • powershell, mshta, certutil or cmd /c inside a Run command, especially with -EncodedCommand.
  • Long blocks of random-looking letters (Base64), or text built from dozens of Chr() calls: a common way to hide commands.
  • RegWrite to a ...\CurrentVersion\Run key or copying itself to A_Startup: makes it start with Windows.
  • InputHook or Input that collects your typing and then writes it to a file or sends it somewhere.
  • ProcessClose or WinKill aimed at antivirus or security tools.
Antivirus warnings: AutoHotkey's FAQ says most alerts about AutoHotkey files are false positives. Upload the file to a multi-engine scanner such as VirusTotal and see what other engines say, and report false positives to your antivirus vendor. Never switch protection off for a script you didn't write or can't read.

A script that only defines hotkeys, hotstrings and window shortcuts, with no downloads, registry writes or command interpreters, is the normal, harmless kind. Still, a static check like ours reads text patterns only; it can't see what a script builds at run time, so it doesn't replace common sense or a real antivirus.

Open AHK files on Mac, Linux, iPhone and Android

On any system other than Windows you can open AHK files to read them, but you can't run them: AutoHotkey is a Windows-only program, and there's no official version for macOS, Linux, iOS or Android.

  • Mac: open the file in TextEdit (right-click > Open With > TextEdit) or use the viewer on this page in Safari or Chrome. For similar automation on macOS, Hammerspoon is a free tool scripted in Lua; the logic must be rewritten.
  • Linux: any text editor opens it. AutoKey is a free, open-source Linux program for hotkeys and text expansion, scripted in Python; it cannot run AutoHotkey scripts.
  • iPhone, iPad and Android: save the file to Files (iOS) or your Downloads folder (Android) and open it with a text-editor app, or use the viewer on this page in your mobile browser to open the AHK file and see the script and its hotkeys.

If you need the script itself on a Mac or Linux PC, the realistic option is a Windows installation (for example, a Windows virtual machine) with AutoHotkey installed.

Sources and technical references

Facts on this page were checked against AutoHotkey's official documentation and project pages on October 4, 2026.

Frequently asked questions

What is an AHK file?

An AHK file is a plain-text script for AutoHotkey, a free automation program for Windows. It holds instructions such as hotkeys, text shortcuts and window commands. AutoHotkey reads the file and carries out those instructions while the script is running; on its own the file does nothing.

How do I open an AHK file without running it?

Right-click it and choose Edit script, or Open with > Notepad. You can also drop it into the viewer on this page, which shows the code with highlighting, lists its hotkeys and flags risky commands. None of these methods execute the script, so they're safe for files you don't trust yet.

Why does Windows ask which app to use when I double-click an AHK file?

Because AutoHotkey isn't installed, so nothing is linked to the .ahk extension. Install AutoHotkey v2 from autohotkey.com and double-clicking will run the script. If you only want to read it, choose Notepad instead; Windows treats the file as ordinary text.

Which AutoHotkey version does my script need?

Look for a #Requires line at the top: #Requires AutoHotkey v2.0 means v2. Without it, v1 scripts usually show commands with commas such as MsgBox, Hello and assignments with a plain equals sign. The checker on this page detects the version automatically and tells you which lines gave it away.

What does "requires AutoHotkey v1, which is not installed" mean?

The AutoHotkey v2 launcher decided the script was written for v1, the legacy version, and you only have v2. Click Yes to let it download and install v1 alongside v2; both keep working. The other option is to convert the script to v2 syntax.

Is it safe to run an AHK file?

Only if you trust its source. A running script can press keys, run programs, delete files and change settings with your permissions. Read it first: hotkeys and text shortcuts are normal, while downloads, registry changes, PowerShell commands or long encoded strings deserve a closer look before you double-click.

Why does my antivirus flag AutoHotkey or a compiled script?

Most of these alerts are false positives, according to AutoHotkey's FAQ, often because some malware has been written with AutoHotkey. Check the file with several engines on VirusTotal, report false positives to your antivirus vendor, and never ignore a warning for a script you got from an unknown source.

Can I convert an AHK file to an EXE?

Yes. AutoHotkey's compiler, Ahk2Exe, packs the script and the interpreter into a standalone .exe that runs on PCs without AutoHotkey. Open the Dash and choose Compile, or right-click the file and choose Compile script once the compiler is installed. Compiling doesn't hide the source from extraction tools.

Can I open AHK files on a Mac or Linux?

You can read them in any text editor, but you can't run them: AutoHotkey is Windows-only. To get similar automation, use Hammerspoon on macOS, which is scripted in Lua, or AutoKey on Linux, which uses Python. Both need the script rewritten; neither runs .ahk files.

How do I make an AHK script start with Windows?

Select the script and press Ctrl+C, press Win+R, type shell:startup and press Enter, then right-click inside the folder and choose Paste shortcut. The script now runs every time you sign in. Delete the shortcut from that folder to stop it.

Can I edit an AHK file in VS Code?

Yes. Install the free AutoHotkey v2 Language Support extension by thqby for v2 scripts, or AHK++ for both v1 and v2. They add syntax highlighting, error checking and code completion, plus run and debug commands. Notepad also works for quick changes; save as UTF-8.

Last updated .