How to Recover Files from a Virus Infected Hard Drive, Memory Card and USB Drive

When you lose files after a virus attack, you can try two possible virus file recovery solution here for help: clean your drive then recover virus infected data using cmd or recover with a professional data recovery software.

Table of Contents

how to retrieve files from usb

How to clean your USB drive and how to retrieve files from USB? Here is the solution.

1. Open a command prompt ( Windows Key + R, then type cmd and press Enter ) and go to your drive by typing drive letter and semicolon like F: then press ENTER.

2. Run this command attrib -s -r -h  *.* and press Enter.

More items...

Have you ever been attacked by one or more unknown viruses? If you have such an experience, you will know that a virus attack can result in unexpected data loss on a hard drive, external hard drive, memory card, or a USB pen drive.

For users who have no idea how to recover virus infected files from USB, it can be a real disaster! But don't worry! On this page, we will introduce to you two possible solutions to retrieve files from USB: repair and recover virus infected files using CMD and recover virus infected files with a professional data recovery software. These solutions should be executed in succession. If the first one doesn't work out, then continue to the second method. 

1. How to Retrieve Files from USB Using CMD 

When your data is hidden, inaccessible, or lost due to a virus attack on a USB pen drive, your best bet is first trying to use the Command Prompt (cmd) to recover hidden files from virus infected USB. Since it is free and well-understood, cmd is an excellent choice. Now let's see how this works. (I will be using Windows 10 for this demonstration, but the process is largely the same for other OS versions)

Step 1. Plug your external hard drive, memory card, or USB drive into your computer

Step 2. Go to the start menu, type in "cmd" in the search bar, hit enter. You'll then see something named "cmd.exe" under a list of programs.

Use CMD to recover files from virus infected storage media step 1

Step 3. Click "cmd. exe" and then you will be directed to the Windows command line that allows you to recover virus-infected files.

Step 4. Type attrib -h -r -s /s /d *.* and hit Enter.  

Windows will then start to find the virus-infected and hidden files on the external hard drive, memory card, or USB drive. After the process finishes, navigate to your disk or card and check if you can see all of the previously virus-infected files.

If YES, congratulations! But if not, don't despair. You have another option. Just try a third-party data recovery software in Solution 2!

2. How to Recover Files from USB with EaseUS Data Recovery Software 

When you fail to recover files from virus-infected USB using cmd, EaseUS hard drive data recovery software comes to solve your problem. This program is a professional recovery software for all storage devices. With its powerful file recovery utility, you can effectively recover deleted, corrupted, or hidden files from virus-infected internal hard drives, external hard drives, memory cards, and USB drives/pen drives. Besides, it's also capable of recovering files from emptied recycle bin. 

Follow the step-by-step tutorial below to start recovering files from a virus-infected USB drive. 

Step 1. Select the virus infected drive to scan

Run EaseUS virus file recovery software on your Windows PC.

  • If it's an HDD where files were hidden or deleted by virus, it's better to install the software on a different volume or an external USB drive to avoid data overwriting.
  • If the infected device is an external hard drive, flash drive or memory card, it doesn't matter to install the software on the local drive of the computer.

Select the correct drive according to its drive letter and click Scan

select a location and click scan

Step 2. Wait for the scan results

The software will immediately start a scan process to find your lost files on the virus infected hard drive. Do not stop the deep scan until all lost files show up. To quickly locate the wanted files, you can use the Filter feature to display only the pictures, videos, documents, emails, etc.

When the process finishes, you can double-click files to preview their contents.

scan deleted files

Step 3. Select file(s) to recover

Select the files you want and click the Recover. You should save these files to another safe spot on your PC/storage device, not where they were lost.

Restore lost data from drive which was infected by virus

Check our video tutorial to recover files:

People Also Ask

1. How show hidden files from virus infection in pen drive?

To recover hidden files from virus infected USB pen drive, you can use the two solutions in this article, one is using the attrib command lines and the other is applying a professional virus file recovery tool to recover infected files.

2. How can I recover files from virus infected USB?

Step 1. Go to Start menu and type cmd in a search box and press Enter.

Step 2. Click cmd. exe and then you will be directed to the Windows command line.

Step 3. Type attrib -h -r -s /s /d G:\*. * (Replace G with your drive letter) to recover virus infected files.

3. How do I recover hidden files on my USB?

You can view and retrieve hidden files from USB In the File Explorer options. select View, click Hidden files and folders and click on Show hidden files, folders and drives. Click Apply, then OK. This operation will make your hidden files visible on the USB drive.

4.. How can I remove virus from my USB without deleting files?

You can remove virus from USB pen drive without losing data in the following way.

Step 1. In the Search box, type cmd to open the command prompt. 

Step 2. Now, type your flash drive letter (for example J) followed with colon i.e. F:

Step 3. Type attrib -r -a -s -h *. * and press enter.  

Was This Page Helpful?

Updated by Cedric

Cedric Grantham is one of the senior editors of EaseUS who lives and works in Chengdu, China. He mainly writes articles about data recovery tutorials on PC and Mac and how-to tips for partition management. He always keeps an eye on new releases and likes various electronic products.

Read full bio

Written by Roxanne

Roxanne is one of the main contributors to EaseUS and has created multiple posts on digital devices like PCs, Mobile phones, tablets, Mac, etc. She loves to share ideas with people of the same interest.

Read full bio

Product Reviews

TrustScore 4.7 | 323 reviews
  • EaseUS Data Recovery Wizard is a powerful system recovery software, designed to enable you to recover files you’ve deleted accidentally, potentially lost to malware or an entire hard drive partition.

    Read More
  • EaseUS Data Recovery Wizard is the best we have seen. It's far from perfect, partly because today's advanced disk technology makes data-recovery more difficult than it was with the simpler technology of the past.

    Read More
  • EaseUS Data Recovery Wizard Pro has a reputation as one of the best data recovery software programs on the market. It comes with a selection of advanced features, including partition recovery, formatted drive restoration, and corrupted file repair.

    Read More