Sign in with
Sign up | Sign in
Your question
Solved

Batch file imitating keystroke

Last response: in Windows 7
Share
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.

Best solution

a c 352 $ Windows 7
April 18, 2011 5:20:30 PM

vbscript can do that, I think a regular .bat file is limited to passing one key reply.

http://en.allexperts.com/q/Visual-Basic-1048/2008/10/Pr...
Share
Related resources
Can't find your answer ? Ask !
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." :) 
m
0
l
April 25, 2011 11:56:07 PM

Best answer selected by honj90.
m
0
l
!