Batch file imitating keystroke

honj90

Distinguished
Jan 5, 2011
21
0
18,510
Is there a way to create a text file (saving it as .bat probably) which when executed will recreate a keystroke press? The keys I need would include modifiers, precisely shift-alt-ctrl-[letter key here].

Thank you in advance for your time.



Some background story for anyone interested: I want to trigger an action in another program each time the computer locks. This program has some kind of event trigger, but it doesn't seem to work correctly with windows user lock in all scenarios. So I set a random hotkey to what I want the program to perform. Then I could through windows task scheduler create a task which triggers on user lock and executes this batch file imitating the hotkey press. This would give me more control and flexibility on the conditions of the task.
 

honj90

Distinguished
Jan 5, 2011
21
0
18,510
Thanks a lot, I'll try them out.
Especially AutoHotkey, I had found it during a google search, but thought you needed to have it installed/running for it work. Apparently not: "Convert any script into an EXE file that can be run on computers that don't have AutoHotkey installed." :)