Pen drives are so small that they can be easily misplaced and even lost. How do you make sure that your lost drive is returned to you by the finder? Leave you name and contact info in the drive? Yes, but we will do it a different way. First we will look at a software that displays a message when a pen drive is accessed, and then we will implement the same thing with our own coding.
USB Lost and Found is an interesting piece of software that informs the finder of a lost pen drive about the rightful owner of the drive. The free edition of this software can display a user configured message whenever the USB drive is accessed.
The tool is actually quite simple: it creates an executable application called “setup.exe” on the root of the pen drive, that displays an alert box with the owner’s email or phone number, and then causes this application to auto launch by creating an auto.ini file. The program is basic and does not prevent anybody from keeping the drive. The programs executable along with the autorun file can be simply removed and the thumb drive kept. However, there is a fair chance that a good citizen will return the drive to you.
USB Lost and Found pro version is different and provides a layer of protection to your pen drive by enabling you to password protect it, in addition to the reminder message. A “Locked Down” pen drive is inaccessible without the password and hence useless, and so he or she is likely to contact you and have it returned. At a price of $3.5 it is quite cheap. (Thanks gHacks)
Now the fun part: let’s make a pen drive display a message whenever it is plugged into the computer without using USB Lost and Found or any software.
Copy the following code, paste it in Notepad and save it with the extension .HTA.
(GradientType=0, StartColorStr=’#000000′, EndColorStr=’#0000FF’)">
Msgbox "This USB drive is lost. Please contact XXX to have this returned. Thanks"
Replace the line within quotes next to Msgbox with your own message. You can also change the background color and even add a background image to it. The parameters inside the <HEAD> and <BODY> tag are self explanatory. It’s all HTML.
Create another file called autorun.ini and paste the following lines. Replace ‘message.hta’ with the file name of the HTA file you created in the previous step.
Copy both the autorun.ini and the HTA file to the root of the pen drive. Now every time the pen drive is accessed, it will make the complete screen go blue and display your message.
Pretty cool, huh? To make it a little hard for the finder to figure out what’s going on, make both the files hidden. Read more about coding HTA applications.