USB drive infected by a virus leading to unexpected data loss? Read this post on MiniTool to learn how to recover virus infected files from USB flash drive by using CMD and the best free data recovery software. Besides, take some measures to prevent your USB drive from being attacked by viruses.

USB drives are one of the most common data storage devices. Although it has the advantages of portability and user-friendly lightweight design, it also has obvious disadvantages, such as being vulnerable to virus attacks.

If a USB drive is infected by a virus, the photos, videos, documents, etc. stored in the drive are likely to be damaged or lost.

Unfortunately, USB drive data recovery is not like simply dragging deleted files from the Recycle Bin because data deleted from USB will not go through the Recycle Bin. So, how to recover virus infected files from USB flash drive? See details below.

Recover Deleted Videos From a USB Drive | Best Practice Ways
Recover Deleted Videos From a USB Drive | Best Practice Ways

Videos on USB are lost or deleted? Read this post to get the most effective solutions to recover deleted videos from a USB drive.

Read More

How to Recover Virus Infected Files From USB Flash Drive

Way 1. Recover Files Hidden by Virus Attack via CMD

One of the common situations after a virus infects a USB drive is to hide the files or folders in the drive, causing the illusion of file loss. To retrieve files hidden by viruses, you need to use the CMD tool to remove the file hidden attribute.

How to retrieve virus infected files in USB using CMD? Follow the steps below.

Step 1. Type cmd in the Windows search box. Then right-click Command Prompt to select Run as administrator.

Step 2. In the command line window, type chkdsk X: /f (X represents the drive letter of your USB drive) and press Enter.

run chkdsk

Step 3. Next, type attrib -h -r -s  X:\*.* /s /d (replace X with the actual drive letter of your USB drive) and press Enter.

Step 4. Now you can check whether your important files are displayed. If not, it means that the files are deleted or lost instead of being hidden. In such a situation, the CMD tool will not help, and you need to consider the following methods to recover virus infected files from USB flash drive.

Way 2. Recover Virus Infected Files From Backup Files

Data backup is one of the important means to ensure data security and reliability. When your USB drive encounters a virus attack, power failure, or human error, you can quickly and easily restore the original files.

Various methods can be used to back up USB files, such as cloud backup, external drive backup, backup of professional data backup software, etc. As long as you have a backup file, you can recover the virus infected USB drive data from the backup.

If you are looking for a professional and reliable USB image tool. MiniTool ShadowMaker is highly recommended. It can effectively back up photos, videos, documents, and other types of files on your USB drive. You can use the trial edition of MiniTool ShadowMaker to protect your USB drive for free within 30 days.

MiniTool ShadowMaker TrialClick to Download100%Clean & Safe

What if you do not have any backup files? In this situation, you have to turn to data recovery software for virus infected USB drive recovery.

Way 3. Recover Virus Infected Files via MiniTool Power Data Recovery

When it comes to USB data recovery software, MiniTool Power Data Recovery is worth trying. It serves not only as a powerful USB file recovery tool for restoring USB drive files, but also functions as a hard drive data recovery service, SSD file recovery software, SD card recovery software, and so on.

Apart from recovering documents, videos, pictures, audio, etc. from virus infected USB drives, MiniTool Power Data Recovery is also adept at handling other file loss situations. For instance, you can use it to recover data from an SD card formatted as internal memory, recover data after reinstalling Windows, recover data from unrecognized external hard drives, and more.

Besides, this file restoration service is fully compatible with all Windows versions, including Windows 11/10/8/7. Now, download the free edition to recover data from the virus infected USB drive.

MiniTool Power Data Recovery FreeClick to Download100%Clean & Safe

Before proceeding with the following steps, you need to insert the USB drive that is infected by viruses into your computer. If possible, please choose a computer that does not contain important files or is intended for disposal to prevent USB viruses from infecting the computer.

Step 1. Run MiniTool Power Data Recovery to go to its main interface. Under Logical Drives, you can see all the recognized partitions on your computer. Select the target USB drive partition marked with a USB icon and click Scan.

scan the USB drive

After that, this secure data recovery service will start scanning the selected USB drive and continuously display the found data during scanning.

You will have the option to halt this process midway, but it is not recommended for optimal scan outcomes.

Step 2. After scanning, generally, there will be a large number of found files listed by file path. To filter out unwanted files and locate the desired data faster, you can make use of the Type and Filter features.

  • Type: Once you move on to the Type category list, the found files will be categorized by file type. If you want to recover a certain type of file, you can focus on that type. For example, if you want to restore photos from your USB drive, you can concentrate on Picture.
  • Filter: This feature enables you to filter out unnecessary data by file type, file modification date, file size, and file category.
view pictures
filter the files

Before recovering the files, you are recommended to preview the located files to make sure they are required. You can preview multiple types of files, including MP4, MP3, JPG, JPEG, PNG, DOC, DOCX, XLS, XLSX, PDF, and more.

preview the video

Step 3. Now you can check the checkboxes next to the needed files. Then click the Save button and specify a safe location to store the recovered files. You need to choose another drive to prevent the data from being overwritten.

save the files

Please note that MiniTool Power Data Recovery Free supports free file preview and 1 GB of free data recovery. If you need to recover files exceeding 1 GB in total, you have to upgrade it to an advanced edition, such as MiniTool Power Data Recovery Personal Ultimate.

My USB drive is infected by viruses. Thankfully, MiniTool Power Data Recovery helped me recover my files. It’s worth a try.Click to Tweet

MiniTool Power Data Recovery FreeClick to Download100%Clean & Safe

Files Copied to a USB Drive Disappear? Recover Data & Fix It
Files Copied to a USB Drive Disappear? Recover Data & Fix It

Do the files copied to a USB drive disappear? Read this post to see how to recover disappeared data and fix the USB drive.

Read More

How to Fix Virus Infected USB Flash Drive

Next, it is time to detect and remove viruses from your USB drive. There are several ways to kill or remove viruses from USB drives. Here we mainly talk about how to use Windows Defender to scan your USB drive and kill viruses along with how to format the drive.

Run Windows Defender

Windows Defender is an antivirus protection utility built into Windows. It protects against viruses and malware on your computer’s internal drives and connected devices. You can use it to scan your USB drive for viruses.

Step 1. Press the Windows + I key combination to open Settings.

Step 2. Click Update & Security > Windows Security > Virus & threat protection.

Step 3. Under Quick scan, click Scan options.

click Scan options

Step 4. Select the Custom scan option, then click Scan now to choose a location.

choose Custom scan

Step 5. In the new window, select the target USB drive and click Select Folder.

Step 6. Wait patiently until the scan process is finished. If you receive any prompts, please follow the on-screen instructions.

Format the Drive

Formatting a USB will delete all files on it, and non-persistent viruses will also be removed. So, to fix the virus infected USB drive, you can try to format it.

You can format the USB disk directly from File Explorer. In Windows Explorer, right-click the USB drive to select Format. In the new window, set up the file system, allocation unit size, and volume label. Finally, click Start.

Alternatively, if you receive a message saying Windows was unable to complete the format, you can use MiniTool Partition Wizard to perform the USB format. The Format feature is available in the free edition of this partition management tool.

Download, install, and launch MiniTool Partition Wizard Free.

MiniTool Partition Wizard FreeClick to Download100%Clean & Safe

On its home page, select the USB drive that is infected by viruses. Then pull down the left menu bar and click Format Partition.

format the partition

In the next window, type a partition label, choose a file system and a cluster size, then click OK.

Finally, click the Apply button located in the bottom left corner.

After formatting the USB drive, the viruses on it should be removed.

How to Fix USB File Transfer Stuck at 0 or 99 Windows 11/10
How to Fix USB File Transfer Stuck at 0 or 99 Windows 11/10

USB file transfer stuck at 0? This post tells you what should you do when the USB file transfer speed drops to zero Windows 11/10.

Read More

How to Prevent USB Drive From Being Attacked by Viruses

To better protect your USB drive and avoid repeated virus infection of the drive, it is necessary to understand the common types of computer viruses and possible virus prevention techniques.

Common Types of Viruses

Computer viruses are extremely contagious and destructive. Many viruses can infect other computers through networks, wireless communication systems, and removable storage devices such as USB flash drives, causing the virus to spread. Here are some common types of computer viruses.

  • Autorun virus: This is one of the most common computer viruses. It can copy itself to flash drives, hard drives, or any other external storage devices.
  • Trojan viruses: By implanting Trojans into web pages and then writing code to allow you to automatically download the Trojans when opening the web pages, your drives will be infected by viruses. These Trojan viruses may be stored locally, disguised as system files or other files, and reproduce, forming a vicious cycle.
  • Worm virus: A worm is an independent program that can run without the intervention of the computer user. It spreads by continuously gaining partial or complete control of vulnerable computers in the network.

Tips to Protect USB Drives From Virus Infection

Viruses cross-spread between USB drives and computers, causing great harm to files and the Windows system. Here are some measures you can take to protect your USB and its data from viruses.

  • Stop USB drives from running automatically. If the USB drive runs automatically once it is plugged into the computer, then if there is a virus on the computer, it can easily invade the USB flash drive.
  • Right-click the USB disk to open it instead of double-clicking the USB drive. This is because as soon as the USB disk is double-clicked, files will start running, which may cause viruses or malicious programs to infect the drive and the computer.
  • Regularly use Windows Defender or other anti-virus software to scan the USB flash drive to detect and eliminate viruses. You can configure some settings to make Windows Defender scan USB automatically.
  • Clean infected USB drives promptly to prevent viruses from infecting your computer or other file storage devices connected to your computer.
  • Try not to use your personal flash drive on an unsecured PC or a public computer.
  • Try to avoid visiting suspicious websites or downloading files from unidentified sources.
  • When transferring files between a USB drive and your computer, make sure the files are safe.
  • Enable USB write protection. This feature puts the USB drive in a read-only state and cannot be written to, which can protect the USB drive from viruses to the greatest extent.

These tips can help you protect your USB drive and files from virus infection.Click to Tweet


This post introduces how to recover virus infected files from USB flash drive, including using the Command Prompt tool, the backup files, and MiniTool Power Data Recovery. After recovering the USB drive files, you can format the USB drive for further use.

Also, it is crucial for you to take note of the tips above to protect your USB drive from virus infection.

If you have any concerns or questions during the data recovery or drive repair process, please feel free to send an email to [email protected].

  • linkedin
  • reddit