This guide from MiniTool shows you two step-by-step methods to recover virus-infected files from the USB flash drive, including the attrib command and data recovery software. Additionally, it introduces how to fix the virus-infected USB on Windows.

As popular data storage devices, USB flash drive are commonly used to store important documents, photos, and other types of files.

When a virus infects your USB drive, recovering your files becomes a priority.

In this article, we will show you three main parts:

  • How to recover virus-infected files from the USB flash drive.
  • How to fix a virus-infected USB.
  • How to protect a pen drive from getting infected by a virus.

Before proceeding to the recovery and troubleshooting methods, you may be concerned about: Is it possible to recover data from a virus-infected USB?

Read on to get the details.

Is It Possible to Recover Data From a Virus-Infected Pen Drive

Virus-infected USB file recovery chances depend on the actions the virus performed on your data.

Here are some common situations a virus may affect your USB files:

Scenario 1. A virus may make the USB files hidden or unreadable.

One of the most common effects is when a virus changes file attributes to “hidden” or “system.”

Although the files are still present on the drive, they cannot be viewed in File Explorer.

In this case, unhide the USB files can resolve the problem.

Scenario 2. A virus may rename or change file extensions.

A virus may change file names to odd characters or change file extensions (e.g., from .docx to .exe, .locky, or .encrypt).

Scenario 3. A virus might make a file corrupted.

Some viruses directly change the file content, leading to corruption of data and rendering the files unreadable or unusable.

In this case, you need a file repair tool to repair the damaged files.

Scenario 4. A virus might delete the USB files.

Certain malware types are crafted specifically to delete files on the infected drive, which results in irreversible data loss.

In this situation, a professional data recovery tool can fix the problem.

Scenario 5. The virus may encrypt the USB files.

Advanced malware like ransomware can lock files on a USB drive and demand a ransom for the decryption key, leaving the files inaccessible without it.

In this scenario, you need a professional antivirus tool.

Scenario 6. The virus may replace and modify the USB files.

An “overwriting virus” replaces the original data on files with harmful code, making recovery difficult.

It often replaces genuine files with shortcut.exe application files. When you open these files, the virus will be released and activated on the computer that the USB drive is connected to.

Restoring from a backup is usually the best option.

The Popular Types Of Computer Virus You Should Know
The Popular Types Of Computer Virus You Should Know

Virus is undeniably the leading threat to computer security, so I think it is necessary to give a brief introduction to the common types of computer virus.

Read More

Take Some Immediate Actions When Your USB Flash Drive Is Infected

Prompt and thoughtful measures can greatly enhance your likelihood of successful data recovery. Here are the immediate steps you should take:

  • Don’t open any files or folders in the USB drive: Avoid clicking on suspicious files, especially shortcuts or executables, to prevent triggering a virus or further damage.
  • Use a secure and up-to-date computer: Connect the infected USB to a PC that has strong, updated antivirus software with real-time protection activated.
  • Stop using the drive to avert data overwriting: The most vital action for data recovery is to refrain from saving any new data to the drive. Continued usage can overwrite lost or hidden files, making them impossible to recover.
  • Disable AutoPlay on your PC: To avoid malware or viruses from running automatically on your computer, open Settings >Devices > AutoPlay. Then, toggle the switch under Use AutoPlay for all media and devices to Off.

Now, keep reading to learn how to recover the virus-infected files from the USB.

How to Recover Virus-Infected Files From USB on Windows

In this part, we provide two solutions to unhide files using the attrib command and recover deleted files using a data recovery tool.

If you have previously set up a backup for your USB flash drive, you can use it to retrieve infected files.

If not, follow the instructions below to rescue your infected USB files.

Method 1. Use the Attrib Command

Sometimes, viruses will hide your USB files instead of deleting them. In such a case, follow the breakdown to unhide them in CMD:

Step 1. Search for cmd in the Windows search bar, right-click Command Prompt, and select Run as administrator.

Step 2. Type attrib -h -r -s /s /d X:\*.* (X represents the drive letter of your USB drive) and press Enter.

This command will remove the hidden, read-only, and system attributes from all files and folders, potentially making them visible again.

Afterwards, check your USB drive in File Explorer to see if your files are accessible.

Method 2. Use Data Recovery Software

If the virus deleted your files on the pen drive, consider using a powerful data recovery tool to recover them.

MiniTool Power Data Recovery is a trustworthy choice.

Here’s an overview of this data restoration tool:

1. Excellent adaptability:

It successfully retrieves data from various storage devices, including USB flash drives, SD cards, and more.

Additionally, it can handle different data loss situations, such as formatted drives and files removed by viruses.

2. Smooth and secure data recovery:

It supports all types of files to recover, including documents, videos, photos, audios, and emails.

The read-only functionality allows for file recovery without generating new data on the drive, protecting the disk and its files.

3. User-friendly interface and straightforward recovery process:

The interface is user-friendly and easy to navigate, with key functions clearly displayed.

In addition, you just need three simple steps to complete the recovery procedure.

4. Various software editions available:

This software offers multiple editions, ranging from free to personal and business versions, addressing your data recovery needs in different situations.

This free data recovery tool provides 1GB of file recovery for free.

Now, download and install MiniTool Power Data Recovery on your Windows PC and follow the instructions to recover deleted files from your USB.

MiniTool Power Data Recovery FreeClick to Download100%Clean & Safe

Step 1. Choose the USB drive to scan.

Connect your USB to the PC. Launch MiniTool Power Data Recovery to enter its main interface. To scan your flash drive, there are two options:

  • Logical Drives: In this section, select your USB drive’s partition with a USB icon and click Scan.
  • Devices: By navigating to this section, you will view all the physical disks that are connected to your computer. Choose your USB and click Scan.
The Devices interface in MiniTool Power Data Recovery showing the connected drives in your PC, with the Scan button selected.

Step 2. Locate and preview the desired files.

After scanning, there are two sections to categorize found files: Path and Type.

  • Path: In this section, all files are organized by their file paths and displayed in various tree structures.
  • Type: In this tab, all files are categorized by their type and format rather than their original organization.
The Type interface in MiniTool Power Data Recovery showing the pictures of the JPG file format, with Path and Type selected.

Moreover, this tool provides the Filter and Search features to narrow down the file range.

  • Filter: This function allows you to filter out undesired files based on criteria such as File Type, Date Modified, File Size, and File Category.
  • Search: This feature enables you to perform a precise search. Type a partial or full file name in the search field located in the upper right corner and press Enter.
MiniTool Power Data Recovery interface displaying the search result for the keyword tree, with the search bar highlighted.

To preview a file, simply double-click on it.

MiniTool Power Data Recovery preview interface displaying a picture of a girl riding a bicycle for file verification.

Step 3. Save the target files.

Ensure that you have selected all the files you wish to recover. Click the Save button in the scan results window, and then select a destination for the recovered files.

MiniTool Power Data Recovery interface showing the checked boxes for wanted files, with the Save button highlighted.

Afterwards, go to the target save location to check your recovered files.

How to Fix the Virus-Infected USB Flash Drive on Windows

After recovering the files from the infected USB flash drive, there are two simple methods to fix the infected drive.

Proceed to get the detailed steps to use Windows Defender and format the USB drive.

Fix 1. Use Windows Defender

To remove the virus, opt for running a virus & threat scan via Settings. This is a Windows-embedded virus cleaner.

Here’s how to do it:

Step 1. Press Win + I to open Windows Settings, then go to the Update & Security section.

Step 2. Select Windows Security and click on Virus & threat protection.

Step 3. In the pop-up window, click Scan options under the Current Threat section.

Step 4. Choose the Custom scan option and click Scan now to proceed.

The Virus and threat protection interface showing the scan options, with Custom scan and the Scan now button selected.

Step 5. In the window that appears, select your USB drive and click on Select Folder.

The Virus and threat protection interface showing the Selected Folder window, with USB and Select Folder highlighted.

You will then see the scanning process. Wait patiently until the procedure is complete.

Afterward, follow the instructions on the screen to finish the USB virus removal process.

Fix 2. Format the USB Drive

Formatting a USB drive can delete all current data, including personal information, viruses, and malware present on the drive.

Therefore, to remove the virus from your pen drive, consider formatting it.

Tips:
If your USB has any important files, remember to back up the data to a safe location.

There are two methods available to format your USB flash drive.

Option 1. Use File Explorer:

File Explorer is a common place to format your USB flash drive. The steps are as follows:

Step 1. Plug the USB drive into your computer.

Step 2. Open Windows File Explorer by pressing Windows + E.

Step 3. Click This PC on the navigation sidebar. In the right panel, right-click the USB drive and select Format.

Step 4. In the pop-up window, choose a suitable file system (FAT32, exFAT, or NTFS) and select the allocation unit size (cluster size).

Step 5. Check the Quick Format option.

Step 6. Click Start to format the USB drive.

The Format USB interface in File Explorer showing the USB formatting information, with Quick Format and Start selected.

Option 2. Use MiniTool Partition Wizard:

If you prefer to use a professional formatter to do this task, MiniTool Partition Wizard is highly recommended.

MiniTool Partition Wizard allows you to format various devices such as external hard drives, SD cards, and USB flash drives into file systems like FAT32, exFAT, NTFS, or Ext2/3/4.

Begin by downloading and installing MiniTool Partition Wizard, then follow the steps below to format your USB drive.

MiniTool Partition Wizard FreeClick to Download100%Clean & Safe

Step 1. Plug the USB drive into your computer.

Step 2. Launch MiniTool Partition Wizard to access its main interface.

Step 3. Right-click on your USB flash drive’s partition in the right panel and select Format.

Step 4. In the pop-up window, specify the partition label, file system, and cluster settings as per your requirements. Then click OK to save your changes.

Step 5. Finally, click Apply to carry out the operation.

The Format Partition window in MiniTool Partition Wizard showing the USB formatting information, with OK and Apply selected.

Bonus Tips: How to Prevent a USB From Getting Infected By Virus

Viruses can spread between USB drives and computers, potentially damaging files and the operating system.

Here are some strategies to protect your USB drive during daily use:

  • Regularly scan the USB drive with Windows Defender or other antivirus software, and set it to scan automatically.
  • Right-click the USB drive and choose Open to access the USB drive instead of double-clicking, which could activate malicious files.
  • Disable autorun for USB drives to prevent automatic execution of potentially harmful files when connected.
  • Activate USB write protection to limit write access and reduce virus risk.
  • Avoid connecting your personal flash drive to any unsecured or public computers.
  • Clean any infected drives promptly to prevent virus spread.
  • Ensure files transferred between the USB drive and computer are secure.
  • Stop visiting suspicious websites or downloading files from unknown sources.

Final Words

This guide primarily explains how to recover virus-infected files from the USB flash drive, repair the infected drive, and safeguard against viruses on the USB.

If you’re uncertain about how to recover infected data and eliminate a virus from the USB, follow this comprehensive tutorial.

If you encounter any issues while using MiniTool products, please feel free to reach out to the support team at [email protected].

  • linkedin
  • reddit