1. Home
  2. Windows Tips
  3. Ahk to exe on windows 10

How to package an AHK script as an EXE on Windows 10

Scripts are a lot like little programs; they run a series of commands and can accept input from a user. They’re mostly used to automate repetitive tasks. AutoHotKey scripts have a wide range of uses. From something basic like remapping keys to more complex operations like renaming and/or moving files and creating directories, the scripts are quite capable. They don’t stand in for batch scripts, but they have their own niche function and are popular on Windows.

Package AHK script as EXE

Convert .ahk to .exe with AutoHotKey

AutoHotKey scripts aren’t hard to run, and the app isn’t hard to install, but it might be easier to run them as an executable.

  1. Make sure AutoHotKey is installed on your system. Download it here.
  2. Open the Start Menu and go to the Apps list.
  3. Go to AutoHotKey in the Apps’ list, and select Convert .ahk to .exe.
  4. In the window that opens, click ‘Browse’ next to the ‘Source (script file)’ field.
  5. Click ‘Browse’ next to the ‘Destination (.exe file)’ and enter a name for the EXE file.
  6. Click Convert.
  7. The script will be converted within a few minutes.

The original script file will be untouched, and you will have a new EXE file.

AHK script as EXE – Command Line

You don’t have to use Convert .ahk to .exe to package an AHK script as an EXE. You can use the Command Line, but you do still need AutoHotKey installed.

  1. Open Command Prompt.
  2. Enter the following command to move to the compiler tool in the AutoHotKey installation folder.
cd C:\Program Files\AutoHotkey\Compiler
  1. Find the complete path to the AHK script.
  2. Enter the following command to convert the script and replace “MyScript.ahk” with the full path to the script.
Ahk2Exe.exe /in MyScript.ahk

Example

Ahk2Exe.exe /in "C:\Users\fatiw\Desktop\Test Script.ahk"

AutoHotKey has extensive documentation, and if you have trouble figuring things out, you can consult it here. You can modify the command and change the icon of the executable file that is generated.

In both the above methods, you’re using the built-in AutoHotKey conversion tool. The difference between them is how you’re using it to convert a script, i.e., via the GUI or the command-line.

Conclusion

Converting a script into an executable doesn’t make it more or less capable. An executable file is supported more widely; automation apps are more likely to be able to run an executable file than a script. AutoHotKey scripts are common, but they’re not as common as batch scripts or bash scripts, so they’re far less likely to be supported by automation apps.