/ Sign-up
Your question

Batch file imitating keystroke

  • Configuration
  • Windows 7
Last response: in Windows 7
April 18, 2011 6:34:43 AM

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.

More about : batch file imitating keystroke

Related resources
April 19, 2011 9:46:01 AM

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." :) 
April 25, 2011 11:56:07 PM

Best answer selected by honj90.