USB Virus Scan is a nice little command line utility that performs predefined operations if an usb drive is connected to your computer.It can distinguish between different drive types so that you can define custom operations for individual drives as well as general commands for all drives or drives that are not recognized by the program. The tool uses the volume serial number of the drives to identify them and perform the selected operations.
Some tasks that come to mind are to start True Crypt automatically when an external encrypted hard drive is connected, or the iTunes software when you connect your iPod, iPhone or iPad to the PC. You can also start a background antivirus scan for all drives that are not recognized by the software.
Note though that the user in front of the PC has full control over the procedure, and that it is possible to abandon or cancel autostart operations. It is therefore not possible to run programs or commands forcefully on the system.
The tool uses the following syntax which you need to add to a .bat file to autostart it with Windows.
USBVirusScan cmd /k %d:
A real example would look like the following. Say you do want to start the file antivirus.exe on drive c:\ whenever a usb device is connected. You create a new bat file which is basically a text file with the .bat extension. Create the file test.bat in the same folder that usb virus scan resides. Add the following line to it.
USBVirusScan "c:\antivirus.exe" %d:
It is possible to add additional parameters. -c hides the command window, -i hides the tray icon, -e disables the exit menu.
I was not able to figure out how to create autostart entries that would use the volume name or volume serial number so I asked Didier the author of the software directly. The following paragraph is his answer to the question, thanks for being so quick to answer it Didier.
On my laptop, I have this entry in the Startup menu: "D:\Program Files\USBVirusScan\USBVirusScan.exe" wscript "D:\Program Files\USBVirusScan\tasks.vbs" %d %s '%v' tasks.vbs will start TrueCrypt when I insert a USB-key with serial number "318606D2" to automatically mount the TrueCrypt volume on the USB-key. If it's my MP3 player that is inserted (volume name PackardBell), 2xEplorer is launched. And in any other case, a virusscan is executed. tasks.vbs:
Set WshShell = WScript.CreateObject("WScript.Shell")
if Wscript.Arguments.Item(1) = "318606D2" then WshShell.run """D:\Program Files\TrueCrypt\TrueCrypt.exe"" /v " & Wscript.Arguments.Item(0) & ":\d1.tc /lz /q", 1, true
elseif Wscript.Arguments.Item(2) = "'PackardBell'" then
WshShell.run """D:\Program Files\2xExplorer\2xExplorer.exe"" D:\MyDirsD\Temp\PodcastQueue " & Wscript.Arguments.Item(0) & ":\", 1,
WshShell.run """D:\Program Files\Network Associates\VirusScan\csscan.exe"" /target " & Wscript.Arguments.Item(0) & ": /secure /quiet /log ""D:\Program Files\USBVirusScan\log.txt""", 1, true
You would have to edit the path and serial volume number to make the script usable but I think it demonstrates the usage nicely.Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.