How to delete Autorun.inf virus from USB

How to delete Autorun.inf virus from USB

Virus attacks are far more common with the increasing use of the internet and external hard drives. One of the most common viruses found is the autorun.inf file. USB flash drives are the most prevalent mode of infection of this malware. This malware generally creates multiple copies of itself in each drive as a read-only and hidden file. This article will show you how to remove the autorun.inf virus.

What is AutoRun.inf virus?

The autorun.inf file is a worm that spreads all over your partitions by creating a copy of itself and usually comes from USB flash drives. It won't let you access your drives by giving you an autorun menu when double clicking on your c: or your USB flash drive.

This is the standard procedure to delete the Autorun.inf file. Normally when a virus infects a Windows system that causes a drive opening issue, it automatically generates a file named autorun.inf in the root directory of each drive. This autorun.inf file is a read-only, hidden, and system file. Moreover, the folder option is also disabled by the virus. This is deliberately done by the virus to protect itself. Autorun.inf will initiate all the activities that the virus performs when you will try to open any drive. You just have to delete this file and restart your system to correct this problem.

There are several ways to get rid of autorun.inf file by formatting the drive, taking ownership of the drive, or using a command prompt. Read on to discover all of them. 

How to delete the Autorun.inf file with the drive formatting?

The easiest and the most radical way to delete the autorun.inf virus file is to copy and back up your data and format the drive. To format the drive, right-click on it and select Format. Then, follow the onscreen instructions.

How to delete the Autorun.inf file via taking ownership of the file?

  • Press the Windows + X keys and open Command Prompt.
  • Type the following command and hit Enter (replace G with the drive letter you need to clean) 
    takeown /f G:\autorun.inf
© Windows
  • Go to your USB flash drive and delete AutoRun.inf.

How to delete the Autorun.inf file via Command Prompt?

If you want to delete the autorun.inf file completely, use the command prompt window and run through the requisite syntax for each drive partition. Follow the below set of commands in order to show and delete the autorun.inf file:

  • Open Start > Run > type cmd and press Enter. This will open a prompt. On this prompt window, type the following commands.
  • Type:

    press Enter

  • Type:
    attrib -r -h -s autorun.inf

    press Enter

Please pay attention to the spacing: no space between the dash and the letter & let a space after the r h and s

  • Type del autorun.inf, press Enter

If the system returns a "file not found" message - check the spell for autorun.inf

  • If you have a g drive: type g: and press Enter. Now please repeat steps 3 and 4. Similarly, repeat step 5 for every hard disk partition.
  • Restart your system, and your issue will be fixed. However, the program that caused the problem is still on your computer.

How to delete autorun.inf with an antivirus?

Make sure you're connected to Internet and download Malwarebytes' Anti-Malware. When installation begins, follow the prompts and don't change the default settings. When the installation is done, ensure you leave both of these checked: Update Malwarebytes' and launch Malwarebytes' Anti-Malware. Then click Finish. MBAM will automatically start, and you'll be asked to update it before performing a scan. If an update is found, the software will automatically update itself. Press OK button to close this box and continue.

On the Scanner tab: Make sure to select the "Perform Quick Scan" option. Then click on Scan. The next screen should prompt you to select the drives to scan. Leave all drives selected, then click on the Start button. The analysis will begin and "Scan in progress" will show at the top. It might take some time, so be patient. When the scan is done, a message box will say, "The scan is completed successfully. Click Show Results to display all objects found". Click OK to close the alert box and continue with the removal process. Back on the main screen, click on the button named "Show Results" to see a list of any found malware.

Ensure that everything is checked, and click Remove Selected. When the removal process is completed, a log report will open, and you may be prompted to restart your computer. The log file is automatically saved and can be opened by clicking the Logs tab in MBAM. Note: If MBAM encounters a file that is hard to remove, you'll be presented with 1 of 2 prompts. Click OK on each of them and let MBAM proceed with the process. If asked to reboot the computer, please do so immediately. Failure to restart will prevent Malwarebytes from removing all the malware.

Need more help with viruses? Check out our forum!
Around the same subject