sendkeys

sendkeys is a command line utility for Windows that can be used to send fake key stroke events to the current or a specified window. One example would be sending the F5 key to a browser from a batch file that monitors files using dirwait, e.g.:

@echo off
:loop
dirwait
<some processing command goes here>
sendkeys -s "Firefox Developer Edition" f5
goto loop

Download sendkeys from here (23K). The archive contains an executable and C source code that should compile with any C Windows compiler. For usage information run dirwait --help:

Usage: sendkeys [-w window caption] [-d ms] [-f] [-r] <keys>
 or:   sendkeys [-m window caption part] [-d ms] [-f] [-r] <keys>
 or:   sendkeys [-p window caption prefix] [-d ms] [-f] [-r] <keys>
 or:   sendkeys [-s window caption suffix] [-d ms] [-f] [-r] <keys>
The keys can be something like: +KEY or -KEY to press or release a key
  if neither + nor - is given then two events will be issued, one for
  press and another for release. A $ can be used to insert a delay
  in millseconds between key presses (e.g. A $1000 B will delay one
  second between A and B).
Unless -r is specified, after keys have been processed, any +KEY
  that didn't have a -KEY will be followed by an implicit -KEY in the
  reverse order that was specified (e.g. sendkeys +CONTROL+A will
  actually send the equivalent of +CONTROL+A-A-CONTROL).
If -w, -m, -p or -s is specified, the window that contains the given
  caption (or part of it) will be focused before sending the keys.
If -d is specified, sendkeys will wait for ms milliseconds. If -d is
  used before -w/-m/-p/-s the delay will occur before activating the
  window and if it is used after, it will occur before sending the
  first keys (this is essentially the same as starting the keys with
  $ and the number of milliseconds in -d).
Unless -f is specified, after the keys have been send, the window
  that was focused before will be focused again.
Use --keys to get a list of known keys.