… is the name of a small Win32 command line tool I wrote. It executes a command whenever a volume (e.g. USB memory stick, portable hard drive) gets connected to or disconnected from the machine. The particular use-case for which it was written is, to execute an NT shell script whenever this happens.
The command can be freely chosen, but must be a program and/or script file. ShellExecute
is used to execute it with the open
verb. In order to make sense, the tool appends arrival
and the drive letter to the command line. If it will be extended, new operations (currently only arrival
) will be defined (e.g. removal
).
So if you execute the tool like this:
arrived myscript.cmd
… it will execute the following command if you plug a USB drive in:
myscript.cmd arrival X:
X: is the drive letter of the newly connected drive. In order to make sure that the drive has settled after connecting, the tool will wait 15 seconds. This is not at the moment configurable. If enough people use it and let me know about it, I’ll probably make it configurable.
// Oliver
Download: here
REDISTRIBUTION TERMS: The source is of course included. The whole package is released into the PUBLIC DOMAIN. Disclaimer: This software is provided ‘as-is’, without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.
NOTE: The SimpleBuffer.h
has its own license and is not released into the public domain, since I do not own the copyright for it! It is available under the BSD license.