Windows – Run script on startup in W10 – version “20H2”

autohotkeybootscriptwindows 10

Uh-oh. I have an Autohotkey script which has always run on startup, for years. I have just updated my W10 OS from 1607 to "the latest", which appears to be called "20H2".

Neither of the methods here seems to work now (I tried both a shortcut in the startup directory for specific user and then all users, and also Task Scheduler, including with a 30 s delay).

Anyone got any insights about this? Is "20H2" a defective thing full of holes and poorly engineered software? That would be a first for Microsoft*.

Incidentally, with the 30 s delay attempt, something does happen after 30s: I get a dialog saying "what application do you want to open this file?". When I choose a simple text editor (TextPad for example) I get a dialog saying "? – OK to create ''D:\My'". HAHAHAHAHAHA. I've become attached to my Windoze-induced misery over the years.

Edit

Have tried many things… to no avail. Not surprised in the slightest.

As user, I reinstalled AHK, latest, 1.1.33. I tried rebooting with and then without TaskScheduler task enabled. No joy.
I noticed there is an extra option when you install AHK, by default unticked: "Add 'Run with UI Access' to context menus". Didn't seem promising, but I tried it. This then insisted that it had to be installed under C:\Program Files. OK. No.

I tried installing as admin, that is: cmd, "Run as administrator"… No.

I tried installing as "secret admin", that is by logging in as the special admin account. No.

Standard MS experience: it simply isn't working. Re the comment "you run the autohotkey script at startup the wrong way": any more to say about that? That shortcut is to an AHK script. When I click on it, it runs my startup script. It was present in both locations mentioned in this answer.

Finally found, first, a workaround (?) with Task Scheduler, and then a partial solution: see my answer…

*This comment is ironic.

Best Answer

Workaround (?) with Task Scheduler

I worked out the way to get the script to run using Task Scheduler: the path to the .exe file (AutoHotkeyU64.exe) is now in the box "Program/script", and the path to the .ahk script in the "Add arguments" box. It didn't work with the path to the script in "Program/script".

NB, for the benefit of anyone experiencing this problem: I find that I have to set a "Delay task for" in Task Scheduler: without it the script fails to run. Although it looks like the shortest delay you can set is "30 seconds", actually you can then edit that "Delay task for" box manually: I have currently set it to "10 seconds", and the script runs OK.

This script is the only thing I execute on startup, but would still be interested to know why the other method is broken on my system.

Partial solution after reinstalling as admin

Finally, when I put it in the "shell:common startup" location... it ran! So it doesn't work for the individual user, only for all users. No idea why. As I said above, previously it wasn't running in either startup location. So it presumably must be due to re-installing AHK (as admin?).

Related Question