RedditPP Mascot

RedditPP

r/AutoHotkey • … • u/Kapitano72

Autostart as Administrator

I've got a set of hotkeys in v2 which I want available pretty much all the time, bundled into "Basics.ahk". They're for things like positioning windows and keeping logs, and I need it to autostart in Administrator mode. "Basics.ahk" is packaged into "Basics.exe" with AHK's compiler, and there's a script called "RunBasics.ahk" which looks like this:

`Run('*RunAs ' a_ScriptDir "\Basics.exe")`

`ExitApp`

There's a .lnk file pointing to "StartUp.ahk" in the Windows startup. So, when I start Windows, "RunBasics.ahk" runs and elevates "Basics.exe".

Seems to work, but surely there's a more elegant way to do this, and I can't be the first to ask this. So, can anyone suggest a better way?

— 0