Solved

Batch file imitating keystroke

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.
4 answers Last reply Best Answer
More about batch file imitating keystroke
  1. Best answer
    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/Press-key-using-vbs.htm
  2. 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." :)
  3. Best answer selected by honj90.
Ask a new question

Read More

Configuration Windows 7