[Tutorial] How To Protect Your USB Drive And Block Virus On It

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.

[ttjad keyword=”portable-hard-drive”]


Boris Zegarac is Staff Writer at TheTechJournal. He is our Tutorial Expert. He is a web developer and web designer who is also interested in Computers and Smartphones. You can follow him at his Google + profile page

This Post Has 2 Comments

  1. Natasha T

    Can i do it also to my PC?

  2. Guest

    By performing this procedure to your PC it won’t have any effects since we are making changes on Autorun file. This is only for removable media such as USB Drive. If you want to protect your PC from viruses visit our Tutorial section where you can find good advice’s on how to protect it.

Leave a Reply