How to remove autorun.inf and prevent virus spreading and infection

Disable your autorun. This is very significant in protecting your computer against online threats. A lot of viruses today uses the autorun.inf file to spread themselves and infect your computer. Autorun.inf contains a command that instructs the computer to run a specific file usually on a CD/DVD disc. In genuine cases , it runs a setup in case of a software installation disc. In the other case it may run a virus and gets your system infected. Same is the case for Mass Storage Devices such as Memory Sticks and Flash Drives. Autorun.inf is typically used by CD Installers to autoplay their installations, but Hard disks by default should not have AUTORUN.INF in the drive.


As you can see from the above image the Drive D: contains a hidden file autorun.inf. This a possibility that drive D: is infected with virus and the autorun.inf file may contain a instruction to spread the virus whenever you double click drive D:. To remove this, Restart your windows into Safe Mode with Command Prompt. On drive D and all other root directories type the following commands:

1. attrib -h -r -s autorun.inf

R Read-only file attribute.
S System file attribute.
H Hidden file attribute.

2. del autorun.inf

Repeat these steps for all of the other drives root’s directories to disable autorun.inf .

How to disable AUTORUN from Registry

Here are the steps to disable autorun via registry. But before doing anything as a safety measure always backup your registry.

  • Go to start –> Run –> Type Regedit
  • Look for the HKEY_CURRENT_USER\Software\ Microsoft\Windows\CurrentVersion\Policies\Explorer as shown below:

  • Double-click the NoDriveAutorun DWORD entry and type the value HEX: FF (255 in Decimal).
  • If the NoDriveAutorun does not exists, you can create it by right-clicking the right side area of the regedit window, then click New–>DWord Value –> type NoDriveAutorun.
  • Close the registry and restart the computer. This procedure will disable all the autorun for all drives of your computer and should prevent the autorun function of infected USB drives or CDs and avoid the infection of viruses.