Since Vista with UAC and other protections, I'm finding that each Major Windows release requires more utilities to be Run As Administrator. This is even for stuff like moving windows on the screen or detecting things about the active window etc..
Windows isn't keen about programs with lesser privilege launching those with greater privilege. This makes it difficult to run a program as administrator at logon without getting the dreaded UAC Prompt. The conventional wisdom is to create a scheduled task. For me this is usually more complicated than the program I am trying to run.
So, since AutoHotkey is a marcro program I thought why not make a program with admin privilege to run all the other programs you want at logon, that run as administrator. This program cannot be run from the users StartUp folder so we make an "ordinary" program and put a shortcut to it in the user's StartUp. This ordinary program merely double clicks the desktop icon of the privileged program that runs all the other privileged programs. Got it?
To avoid hard wiring the names of all the programs I want to run as administrator I made a folder in the folder I use for my small utilities(C:\Utils) called StartAdmin. Any program you wish to run at startup that must be run as Administrator just make a shortcut to the program with Compatibility Tab set to whatever(I often use Windows 7 in W8 as it seems to work better) and at the bottom make sure Run As Administrator is checked. Put the shortcut in the C:\Utils\StartAdmin folder.
On my system I have the desktop shortcut to the program that will run everything in this folder, at the left of the screen second row from the top. But you can use the Window Spy that comes with AHK to get the x y coords so that the double click hits the target.
Here's the code to the program that double clicks the desktop icon
btw I am using the AHK just released today AutoHotkey220.127.116.11.1
If (ErrorLevel) ; quit if ReRun already running
Note that instead of ReRun.exe in the Process,Exist line, you can use any of the programs you will be running as administrator, just to avoid launching them again if somehow they were already started.
The MouseMove x,y numbers should be adjusted so the double click(Click 2) hits the icon.
The program below, must be compiled with the directive requiring admin privilege so that it may launch all the shortcuts in the folder we have designated for our Run As Administrator startup programs.
* * * Compile_AHK SETTINGS BEGIN * * *
* * * Compile_AHK SETTINGS END * * *
Again, the code is hard-wired to use the folder
For something this small it's probably easier to
just edit the script. Note that it loops through every
file with a .lnk extension, which is that used by
The main thing is to have your desktop icon that is the target
of the double click in a location where it is not likely to be
obscured at logon.
Right now I'm using this method to start ReRun, MoveIt and
Transpose, all of which need Run As Administrator to work
well on Windows 8.0, at logon.
A kludge but it's better than remembering to manually start
them all. And I just don't have any desire to mess with all
that quagmire of detail required to get a scheduled task to