Skip to content

Instantly share code, notes, and snippets.

@guychouk
Last active March 15, 2021 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guychouk/159cac455b2a5336e3a2e9519c850349 to your computer and use it in GitHub Desktop.
Save guychouk/159cac455b2a5336e3a2e9519c850349 to your computer and use it in GitHub Desktop.
Register a Scheduled Task to run AutoHotkey script at Windows startup (specifically on user logon).
Register-ScheduledTask `
-TaskName "AHK-Macros" `
-Action $(New-ScheduledTaskAction -Execute "path\to\ahk.exe" -Argument "D:\Drive\etc\macros.ahk" -WorkingDirectory "D:\Drive\etc") `
-Trigger $(New-ScheduledTaskTrigger -AtLogOn) `
-Principal $(New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment