• January 21, 2022

Instructions for removing viruses from a USB flash drive using standard Windows 10 tools

Malicious programs are often spread via USB drives and other external media. Viruses from an infected flash drive or removable hard drive are activated as soon as the device is connected to the computer. Since Windows 10 usually opens the root path of the USB drive in File Explorer, this leaves the system open to infection.

To avoid this type of threat, it is recommended to regularly scan external media for malware using specialized programs or the built-in Windows Defender. Also, before transferring any files from one PC to another using a flash drive, you need to scan it with an antivirus on the initial computer.

If you do not have antivirus installed, or you doubt the scan results, below are two ways to remove suspicious files from removable media. It is worth noting that these methods are also effective on older versions of Windows 7, 8, and 8.1.

Method 1. Removing viruses from a USB drive or hard drive

Instructions:

  1. Connect your USB drive to your computer.
  2. Right-click the Windows icon and select Command Prompt (Admin).
  3. In the system window, enter the command: “E:” (without quotes), where the letter “E” must be replaced with the one that marks the flash drive in the explorer. It must be written in English.
  4. Then press Enter, which will open the removable storage directory.
  5. Next, enter the following command: E: attrib -r -a -s -h *. *
  6. After pressing the Enter key, a command will be executed to make changes to the files of the flash drive. The letter “E” at the beginning must also be replaced with the appropriate drive.
  7. Next, enter the command: DIR
  8. After pressing the Enter key, all files infected with a virus in the flash memory or on the hard disk will be displayed.
  9. In addition, all files will be displayed, including those that were initially hidden, among them one or more files with the .inf or .lnk extension will be searched for.
  10. Also, viruses often infect the autorun.inf file.
  11. To remove it, type the following command and press Enter: del autorun.inf

How to remove viruses from USB drives in Windows 10?

If there are other files with the specified extensions, repeat the execution of the previous command, replacing the autorun.inf name with the name of the infected files.

Method 2: Remove malware from USB drive using batch file (.bat)

To remove a virus from a USB flash drive using a batch file with .bat resolution, you must do the following:

  1. Connect a USB drive or external hard drive to your computer.
  2. Open Notepad.
  3. In the opened document, copy and paste the following
  4. @echo off
    attrib -h -s -r -a / s / e: *. *
    attrib -h -s -r -a / s / e: *. *
    attrib -h -s -r -a / s / e: *. *
    @echo complete
  5. As in the previous version, you must replace the letter “e” with the one assigned to the USB drive.
  6. Save the file with any name and add the .bat extension at the end so that the entry looks like this: Remove_Virus.bat
  7. Also, before saving the file, you must set the File type field to: All files.
  8. Then close notepad and right-click on the created file.
  9. Select Run as administrator.
  10. After that, the process will start to remove all suspicious files from the flash drive, including those with the .inf and .lnk extensions from the first method.

How to remove viruses from USB drives in Windows 10?

Earn points and exchange them for valuable prizes – details

Leave a Reply

Your email address will not be published. Required fields are marked *