How to make a batch file to run a hotkey

g Void picture g Void · Apr 3, 2014 · Viewed 39.5k times · Source

Every time I start my Windows I want to execute a hotkey (Ctrl+Alt+1) using a batch file and putting it in startup folder. Is that even possible? Is there a command for that?

Answer

bgmCoder picture bgmCoder · Apr 3, 2014

The original question was tagged autohotkey.

You can, indeed, use a batch file to run a autohotkey script.

In your batch file, just run autohotkey and send the path to your script as the parameter.

"c:\program files (x86)\autohotkey\autohotkey.exe" "c:\scripts\hotkey.ahk"

And in your autohotkey script, do something like this:

send ^!1
exit

That's it.

Of course, if autohotkey is installed on the computer, you could just put a link to the script in your startup folder in the start menu. That's what I do.