How to build AHK scripts automatically on startup?
Solution 1:
Simply add a shortcut (don't need to be the actual file) of your script in the Windows 'Startup' folder.
Three ways to get there:
1- In Windows Explorer, go to %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
or
2- Start > Programs > Startup
or
3- Open Windows' Run application (Windows + r) write shell:startup
in the edit field and click on the 'ok' button.
ps: Win10 blocks scripts in startup with AHK running as admin... read the comments of this post for extra info.
Solution 2:
Run at startup in Windows 10:
- Compile the script to *.exe
- Put the shortcut of that exe in startup folder "%appdata%\Microsoft\Windows\Start Menu\Programs\Startup"
- That's all. Do NOT set it to run as admin. Programs in Win10 don't run at startup which are marked as run as admin.
Run Script as admin at Startup in Windows 10:
- Go to ahk script and mark it run as admin.
- Create the VBScript using a text editor
'put it in startup folder to run the mentioned ahk script at startup
Set WshShell = CreateObject("WScript.Shell" )
WshShell.Run """C:\Users\jerry\Downloads\scripts\some_script.ahk""", 0 'Must quote command if it has spaces; must escape quotes
Set WshShell = Nothing
Replace C:\Users\jerry\Downloads\scripts\some_script.ahk
with the path to your script with extension and save it as .vbs.
- Place this .vbs script at startup folder
%appdata%\Microsoft\Windows\Start Menu\Programs\Startup
PS: My fav AHK scripts: https://gourav.io/blog/autohotkey-scripts-windows