Starting an AutoHotkey Script on Windows 11/10 Startup

Published by Nyau Wai Hoe - Updated on

AutoHotkey (often abbreviated as AHK) is a powerful scripting language for Windows that allows users to automate repetitive tasks, create hotkeys, manipulate windows, and much more. One of the most common desires among AHK users is to have their scripts run automatically on Windows startup.

In Windows 11 and 10, there are primarily two methods to achieve this: the Startup Folder method and the Task Scheduler method. Both are efficient, but they serve different needs. In this guide, we’ll discuss each method, providing a step-by-step walkthrough to get your AHK scripts running automatically at startup.

How to Start AutoHotkey Script on Windows 11 10 Startup

How to correctly use the Startup folder to start an AutoHotkey script on Windows startup

The Startup Folder is a special location in Windows where you can place shortcuts to applications that you want to run automatically when you log into your computer. This method is straightforward and easy to set up.

Also see: Where is the Startup Folder in Windows 11/10 for All Users


  1. First, you’ll need to locate your AHK script. Navigate to the folder containing your .ahk file.
  2. Right-click on your AHK script and choose “Create shortcut”. This will produce a shortcut of the script in the same directory.
  3. Now, press the Windows + R keys simultaneously on your keyboard. This will open the “Run” dialog box.Create shortcut for autohotkey ahk script
  4. In the “Run” dialog box, type (or copy-paste) the following:

    Open startup folder via Run command in Windows 11

  5. Click “OK” or press the Enter key. This action will open the Startup folder for your user account.
  6. Now, simply drag and drop the shortcut you created in step 2 into this Startup folder.Start an AutoHotkey script on Windows startup using startup folder
  7. That’s it! Your AHK script will now run every time you log into your Windows account.

To run your AHK script on startup as administrator:

  1. Within the Startup folder, right-click on the AHK script shortcut you just added and select “Properties”.
  2. Navigate to the “Shortcut” tab in the “Properties” window.
  3. Click the “Advanced” button located at the bottom-right of this window.AHK script advanced properties
  4. In the pop-up window, tick the box labeled “Run as administrator”.Run autohotkey script on startup as administrator in Windows 11 10
  5. Click “OK” to close the Advanced Properties window, followed by another “OK” to exit the Shortcut Properties window.
  6. Upon your next system startup, Windows will prompt for permission (due to User Account Control) to run the script with administrative rights. Grant this permission, and your script will launch with elevated privileges.


  • If you wish your script to run for all users, use the command shell:common startup in step 4 instead. This will open the common startup folder, and any shortcuts placed here will run for all users on the system.
  • Remember that if you move the original .ahk file, the shortcut might stop working. Always ensure the original file remains in its location.
  • Take caution when allowing scripts (or any application) to run as an administrator. Ensure the script is free from malicious intent or actions.

Schedule an AutoHotKey script to run on Windows startup using the Task Scheduler

Using the Task Scheduler offers more flexibility than the Startup Folder. It allows you to set conditions, choose different triggers other than startup, and specify user permissions. This is especially useful for scripts that need to run with elevated privileges or at specific intervals.


  1. Press the Windows key and type “Task Scheduler”. Click on the Task Scheduler app that appears in the search results.Open Task Scheduler Windows 11
  2. In the right pane, click on “Create Basic Task…”.Create a basic task in task scheduler
  3. In the “Name” box, give your task a descriptive name, like “My AHK Script Startup”. You can also provide an optional description. Click “Next”.Name the task to run ahk on startup
  4. For the trigger, you have a couple of relevant choices:
    • Select “When I log on” if you want the script to run every time you log into your computer. This is suitable for most personal scripts that are user-specific.
    • Alternatively, select “When the computer starts” if you want the script to run as soon as the computer boots up, even before anyone logs in. This might be useful for scripts that have system-wide effects or need to start before any user logs on.

    After making your selection, click “Next”.Set a task to run on computer startup or log on

  5. For the action, select “Start a program”. Click “Next”.Schedule a task to run autohotkey on startup
  6. In the “Program/script” box, type or browse to the location of the AutoHotKey executable (typically located in C:\Program Files\AutoHotkey\AutoHotkey.exe or similar).
  7. In the “Add arguments (optional)” box, type the path to your .ahk script, enclosed in double quotes. For example:
    Click “Next”.Start autohotkey script on Windows startup with Task Scheduler
  8. Review your settings in the summary page, and if everything looks correct, click “Finish”.Finish setting up a task

Advanced options:

  • If you need your script to run with elevated privileges (as an administrator), before finishing the creation of the task, click on “Open the Properties dialog for this task when I click Finish”. In the properties dialog, under the “General” tab, check “Run with highest privileges”.How to start autohotkey script on Windows Startup as Administrator
  • Task Scheduler also allows for running tasks at specific intervals, under specific conditions, or even when specific events occur. These options can be configured under the “Triggers”, “Actions”, “Conditions”, and “Settings” tabs in the task properties dialog.


  • Using the Task Scheduler ensures your script can run with elevated permissions if needed. This is essential for scripts that might need to interact with protected system functions or files.
  • It’s always a good idea to test your scheduled task after creating it. Right-click on the task in the Task Scheduler main window and select “Run” to see if your AHK script starts correctly.

Related resource: How to Run Batch File Without the CMD Window

Troubleshooting common issues

While the aforementioned methods are generally reliable, you may encounter issues occasionally. Here are some common problems and their solutions when trying to start AHK scripts on Windows 11/10 startup:

Script doesn’t run on startup:

  • Check the path: Ensure that both the AHK executable and the script file paths are correct. If you’ve moved the script or the AutoHotKey installation, you might need to adjust the paths.
  • Run as administrator: Some scripts require elevated privileges. Try setting the shortcut to run as administrator through its properties window. Also, remember to enable the “Run with highest privileges” if you are using the task scheduler method
  • Dependencies: Your script might rely on other files or programs. Ensure they’re available and in the expected location when the script starts.

Script runs but doesn’t function as expected:

  • Delay on startup: Some scripts might be dependent on other services or programs that start up with Windows. You can add a delay to your script using the Sleep, DurationInMilliseconds command in AHK. For instance, Sleep, 10000 will delay your script by 10 seconds.
  • Context-sensitive actions: If your script works with specific windows or applications, ensure they are available and in the expected state when the script runs.

Task Scheduler issues:

  • Check task status: In the Task Scheduler, you can see the last run result and the status of the task. This can provide clues if there’s an issue.
  • Review task history: Task Scheduler keeps a history of when tasks are triggered and if they encountered any issues. This is particularly useful for diagnosing problems.
  • Check conditions: If you’ve set specific conditions for the task (like running only when on AC power), ensure those conditions are met.

Wrapping up

AutoHotKey scripts are incredibly versatile, and there’s no necessity to compile them to have them run on Windows startup. Both the Startup folder method and the Task Scheduler method are effective ways to get your AHK scripts running automatically. However, if you ever encounter issues or need more control and flexibility, the Task Scheduler method is generally more recommended.

Categories: Windows 10Windows 11

Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link