Why write protect your USB flash drive ?

When you put your USB flash drive in a pc infected with virus, the virus gets attached to your pen drive and then it infects all computers where it is used. But sometimes we are forced to use pen drive in such pc. So is there any way to prevent virus getting infected in a pen drive ? If your pen drive has a "make read only" switch, then you need to just make it read only before inserting it into a suspected pc. But nowadays most pendrives do not have such "make read only" switch, so the following solution may be handy.

Making a pen drive read only or write protect using Registry

The following method will work for Windows XP and Vista. You need to have admin privileges for this to work because it involves writing into common area in registry.
Download this zip : EnableOrDisableUSBWrite.zip (1kb)

There are two files inside this zip DisableUSBWrite.reg and EnableUSBWrite.reg . Extract this zip and double click DisableUSBWrite.reg before you insert the flash drive into the USB drive. You will be prompted with a confirmation before writing to registry. Once you get the confirmation message, now you can insert the pen drive into USB drive. Just to make sure this worked, try creating a New folder inside the flash drive, you have to get the "Media is write protected" message.

Once you remove the pen drive you should change back the USB drive into write mode. For this double click the EnableUSBWrite.reg. After confirmation ther registry is changed to make the USB drive into write mode.