[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Keep safe your USB flash drive from "autorun" virus

Published on
13,116 Points
3 Endorsements
Last Modified:
Having experience of IT technologies , Electronics and communication  , IT security
Nowadays most people suffering from USB flash drive Autorun virus, may not even know that their flash drive is infected -- this virus is not detected by some anti-virus programs.  Different types of Trojans/worms can be bound with autorun.

Sometimes your system anti-virus program detects autorun infection and could clean, but it may not disinfect the hardly detectable Trojans/Worms which is bound to Autorun and set deep to registry level.   And let them work (obvious spying/destruction) without knowledge of user and antivirus system until they found it.

Another thing is when user knows them USB flash drive is infected with virus. They just simply format the drive or scan with anti virus. In the next instance they won't know that, will the flash drive is safe for further use ?

Even you can't just figure out the system is already is infected with autorun virus in whitch you are going to use your flash drive, and by chance the system is already infected the virus is come back and infect your flash drive again.

I will explain you a simple way to get rid off this thing, even you don’t need any anti-virus to disinfect your Flash drive when this applies.

NOTE: you need proper administrative rights to before following all below steps, logged in as a full administrative rights (local administrator) in windows. Users (IT PRO) who knows about Windows Batch file can create batch file for all operation.


First step copy your data to your computer and full format your USB flash drive with FAT/FAT32/NTFS what ever you like.


To format USB flash drive right click on your flash drive in my computer > click on format > choose file system (do not click file compression while format with NTFS) > keep default Allocate unit size > type volume label why ever you want > click on start button to begin formatting.


Some time it will pop the error message “cant format drive the file is being used by system”. This is what autorun.inf (super hidden file) in flash drive that prevents to being formatting and attracts virus.


For the solution of above step, simply remove flash drive from computer and re-plug it, (don't access flash drive by going my computer > drive letter) go to start > run > type “cmd” without quotes and press ok button, you will bring a black screen of DOS command window.


In command window type “USB drive letter:” without quotes. (if you don’t know USB drive letter, go to My Computer and check, it some thing like K: or F:), e.g. “k:” press enter button in keyboard.


Now your are in USB Drive, here you have to delete autorun.inf file that cause problem to prevent the formatting the drive.


Type following commands:
      attrib –h –s –r autorun.inf
press enter, then:
     del autorun.inf
press enter.  (Type y if ask for conform delete).  Don't close DOS window when done, stay it opened.NOTE: The attrib command is very character case sensitive; you have to write exact what mentioned here, there are space after attrib command, space between "-h","-s" and "-r" and before "autorun.inf"  

autorun.inf file is super hidden in USB drive. You can see this file by
     dir /ah
Command in DOS window before delete it, if you cant find the "autorun.inf" file using "dir /ah" then skip step 7 and continue to next step.


when autorun.inf file successfully removed from your USB flash drive, your can now easily format your drive (if your USB flash drive is already formatted with NTFS, you need to make sures to un check “allow indexing service to index this drive for fast file searching” using right click on USB drive in My Computer  > Properties before format )


Once you have completely formatted your USB flash drive, close all open windows except DOS window (step 7).  Again don't access your drive using my computer.


Go back to command window (see step 7, if you closed it by mistake don't worry, check step 4 and 5 how to get it back), in USB Flash drive make a new directory (folder) with name Autorun.inf  Type the following command
    md Autorun.inf
and press Enter.


Remember that you have to create new empty directory not file named with “Autorun.inf” in USB flash root drive using DOS.


Once this is successfully done, you don't need to worry about autorun.inf virus, because the folder created in USB flash drive will prevent to make new file by your system and change by any autorun virus.


Keep in mind to never delete or rename the autorun.inf folder; as long as it's there, you are protected.


This will disable autorun drive menu ability of your USB flash drive, but keep safe it from autorun virus
Precaution is better than cure!!!
LVL 18

Expert Comment

by:Ravi Agrawal

How about this utility.

You get my Yes vote though.

LVL 31

Expert Comment

by:Thomas Zucker-Scharff
Voted helpful as well.  What about USB-set (note that this will download the tool)?  It basically does the same thing you are suggesting, in that it writes an autorun.inf folder with a hidden read only file in it in order to innoculate non system drives.  It also can easily be set to disable autorun/autoplay.

Featured Post

Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

Join & Write a Comment

Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Key to your CPU's ability to stay cool is to use the right amount of thermal paste and apply it correctly. In other words you want as much thermal conductivity between CPU and the cooling block. Use a quality thermal paste and apply it in a manner…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month