I want to run a program, say a batch file, when any USB mass storage device is connected. I also want to pass the drive letter as a parameter to this batch file.
This can perhaps be achieved using combination of event manager and task scheduler but I don't know how.
I am also open to use third party programs as long as they are free.
I actually know a software that has this capability. But I am looking for a free alternative.
PS: I am running Windows 7 x64 Ultimate
wmic logicaldisk where drivetype=2will show all attributes, else filter like this:wmic logicaldisk where drivetype=2 get caption,description,drivetype,filesystem,volumename. devcon can also help; usedevcon find *usbstor*ordevcon status *usbstor*. – Karan Mar 11 '13 at 05:56