How to Fool Around with the New AutoHotkey Version 2.0

Test the Alpha Release of AutoHotkey V2.0 Without Losing All of Your Version 1.1 Apps

In my last blog, I said that you have plenty of time for making your AutoHotkey V2.0 decision. But, that doesn’t mean you can’t play with the current V2.0 version.

Natural curiosity forces many of us to explore the possibilities of the not-quite-ready-for-primetime 2.0 version of AutoHotkey. But, who wants the trouble of uninstalling (and reinstalling) AutoHotkey 1.1 or continually moving around the various versions of V2.0? Fortunately, you can set up both versions of AutoHotkey to coexist without interference. No need to continually move and/or rename of the main AutoHotkey file (AutoHotkey.exe). Using the approach offered here, you can simultaneously run your current V1.1 scripts while playing around with the future V2.0.

Installing AutoHotkey Alpha Versions


To run any version of AutoHotkey, you only need the matching main AutoHotkey.exe file (AutoHotkeyU32.exe or AutoHotkeyU64.exe) located somewhere on your Windows computer. The main AutoHotkey install program (after copying the files to the primary folder) merely adds menu items to the right-click context menu, creates a Desktop icon, and relates (i.e. Opens with…) the .ahk extension to the main AutoHotkey.exe program. As long as you don’t overwrite the V1.1 files found in the C:\Program Files\AutoHotkey folder, your original AutoHotkey scripts should continue to run unabated. By placing the alpha V2.0 AutoHotkey files in a separate folder, we can connect new V2.0 scripts to the appropriate version of the AutoHotkey program.

Download the Latest AutoHotkey V2.0 Alpha Zip File

You’ll find the latest alpha release at the Downloads for AutoHotkey 2.0 page. Click on the most current version to download the ZIP file. After downloading the ZIP folder, extract all the compressed files to an appropriate folder, but not the main AutoHotkey folder mentioned above. I created a subfolder in that main AutoHotkey folder named C:\Program Files\AutoHotkey\AHK Version 2.0.

Note: Depending upon your version of Windows and your security software settings, you may need to bypass protections added when downloading and/or extracting a file.

Unblock the New Alpha Download

Navigate to the folder where you extracted the AutoHotkey files. In Windows 10, right-click on the filename of the AutoHotkey program version you plan to use: 32-bit or 64-bit. Select Properties at the bottom of the right-click context menu to open the Properties window.

AHK Version 2.0 Unblock

Check the Unblock box at the bottom of the window (if any) and click Apply. (Depending upon your security software, these procedures may vary.)

Now, you need to connect the program to your AutoHotkey V2.0 scripts.

Connect New Extension to Default Program for Opening V2.0 Scripts

To prevent program confusion, use an extension for your AutoHotkey V2.0 scripts other than .ahk. The V1.1 install program registered the .ahk extension to launch the matching version of AutoHotkey. Pick something similar yet distinctive such as .ahk2.

Create a new text file with the .ahk2 extension for your first AutoHotkey V2.0 script and add the following test code (or other V2.0 commands):

Gui := GuiCreate()
Gui.Add("Text",, "Please enter your name:")
AHK Version 2.0 Test GUI
After registering your V2.0 script extension (e.g. .ahk2), this GUI should load with a double-click of the filename.)

After inserting the above code into a blank text file, save it as V2Test.ahk2 (or whichever extension you plan to use).

Note: Don’t save the file as a .ahk file. If you append the usual .ahk extension, the script will fail when loading since it runs with AutoHotkey V1.1.

Open Windows File Explorer (microsoft_key+E) and navigate to your new V2.0 (.ahk2) script. Right-click on the filename and select Properties from the bottom of the context menu. To the right of the Open with: line, click the Change… button.

AHK Version 2.0 Opens with

The Open with program selection window pops up. Click More apps, then scroll down all the way to the bottom of the window. Click the link Look for another app on this PC.

AHK Version 2.0 Pick app

Navigate to and select the main AutoHotkey V2.0 program you plan to use for this new extension. Click Open, then Apply in the Properties window.

This procedure connects the new extension to the AutoHotkey V2.0 program. Every time you Open (double-click) any .ahk2 file V2.0 loads the script. You only need to do this procedure once to register the new extension. All new .ahk2 files automatically load the same default V2.0 program.

If necessary, you can later change the connection through the Windows Control Panel.

AHK Version 2.0 Associate File Types

Test the new script with a double-click of the filename in Windows File Explorer (or select Open from the right-click context menu). The test GUI window (shown earlier) should pop-up. If it does, then you know everything works. Use the .ahk extension for scripts running V1.1 and use the .ahk2 extension to run V2.0 scripts. You need no further changes to load both types of scripts simultaneously. On the downside, you won’t see the Run Script and Compile Script items in the right-click context menu for .ahk2 files, but, after all, you’re only playing with AutoHotkey V2.0.

If you want to upgrade to a more recent version of AutoHotkey V2.0, merely copy the new extracted file into your current V2.0 folder.

Note: I can’t stress enough not to make AutoHotkey V2.0 your main AutoHotkey.exe program…at least, not yet. Currently, in alpha testing, V2.0 may go through many changes before its final general release. Moving to V2.0 requires substantial changes to most V1.1 scripts. Plus, even once released, you can take your time with any upgrade by running both versions simultaneously as shown in this blog.


One thought on “How to Fool Around with the New AutoHotkey Version 2.0

  1. If I create a test .ahk2 script and in the script I just have “msgbox”, then it’ll run fine.

    However, If I try to make the script run as admin using this:

    If not A_IsAdmin
    Run *RunAs “%A_ScriptFullPath%”

    then I’ll get an error upon running the script. The above works completely fine in a normal .ahk extension.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s