If you are connecting your USB drive on public computers and transferring data on it, there is a big possibility that it can be infected by a virus and next time when you plug it into your computer you can easily infect him without even knowing. In order to protect your USB drive and block viruses from accessing it the solution is to create a text document on your USB drive called autorun.inf. By creating this file, a virus can not infiltrate our USB drive because it creates the same files to run, but can not save it because the same file already exist.
To prevent the virus from modifying or deleting your files on USB drive follow steps below:
Step 1: Open Notepad app in your Windows. Leave the file empty, click File and from drop down menu choose Save As.
Step 2: For its name type autorun.inf and save it to your USB drive. NOTE: It is important that this file is not created within a folder, it must be in the root of your USB drive.
Step 3: Next click Start menu, inside search field type Run and press Enter on your keyboard.
Step 4: Inside Run window type command cmd and click OK.
Step 5: When Command Prompt window opens up, type in following command: Attrib +h +s +r -a and then type the path to file you created in Step 2. In my example it will be: Attrib +h +s +r -a G:autorun.inf where G is the USB drive letter.
Now you can forget about these files and you can be sure that your USB drive wont be infected.