usb drive - Autorun batch file through eject command -
is possible batch script on local machine (e.g. in d:\ batch files\1.bat) run after insert or eject usb drive?
preliminaries:
- right-click
computericon, selectmanage, goservices,
selectwindows driver foundation - user-mode driver framework, make sure it's running , startup type setautomaticorautomatic (delayed start).
now go task scheduler:
- make new task, name
mycoolbatch on usb-connect. on
triggerstab add new trigger:on eventin first dropdown boxmicrosoft-windows-driverframeworks-usermode/operationalin log dropdowndriverframeworks-usermodein source2003in event id (this usb connect event)
on
actionstab make new action , select batch file.
can add parameterplugged.
repeat steps 1-3 event id 2100 (the usb disconnect event) , batch file parameter ejected so, assuming same batch file used, can check if device connected/ejected:
if "%1"=="plugged" ......... if "%1"=="ejected" ......... based on the windows 7 event log , usb device tracking article.

Comments
Post a Comment