Auto-Repair Tool

Run Autohotkey Scripts As Admin To Avoid UAC Prompts When Running Scripts

Running Autohotkey Script With Admin Rights_thumb.jpg 1If you are using Autohotkey to write scripts for Windows 7 and you are annoyed that you are still prompted by UAC for elevated rights then here’s the solution.

1. Step Go to your AHK script file and right click on it, then select Compile
Compile Ahk Script 1

2. Step As you can see in the picture, a green “idletimelaunch.exe” will appear.

3. Step Right-click on the .exe file and click on Properties

4. Step Go to the tab Compatibility and at the bottom check the box Run this program as an administrator (Privilege Level)

Run This Autohotkey Script As Administrator 1

5. Step Hit Apply and you can now execute this .exe file and all commands that you are running in your AHK script will be executed with admin privileges

EXAMPLE: How to run bat file with admin privileges:

Let’s say you wanted to run a batch file with admin rights e.g. a backup batch that requires elevated rights. Normally AHK would throw out a UAC prompt when you add this code:

Run C:\Users\sOliver\Documents\Useful.bat

However, when you compile the script and check the box Run as admin as described above it will work just fine. Just perfect for an unattended backup batch file.

I hope this will help some of the AutoHotkey newbies out there.

Alternative Solutions: Auto-Repair Your PC And Drivers

Still Having Trouble? Try TWEAKBIT FIXMYPC - FREE

Published: Sunday, February 26th, 2012 Last Modified: February 26, 2012

Related Posts

Rate This Article
5 of 5 0 (100%) 1 vote