Wondershare Recoverit

Hard Drive Recovery

  • Recovers deleted or lost files from hard drive effectively, safely and completely.
  • Supports data recovery from 500+ data loss scenarios, including computer crash, partition loss, accidental human error, etc.
  • Supports 1000+ file formats recovery with a high success rate and without any quality loss.
Free Download Free Download Free Download Learn More >
hard drive recovery

How to Recover Flash Drive Files Using CMD cloud

Wondershare Recoverit Authors

Jan 15, 2024 • Filed to: Take Data Backup • Proven solutions

File recovery is a process through which you can regain lost data on your computer, external hard drive or other device. There are many reasons why you could lose your files – accidental deleting, malware corruption, power outages, power surge and a host of others.

data recovery graphic

It’s utterly frustrating when you cannot access important data when you thought they were safely stored. If you have lost any files from your flash drive, I have good news for you. You can get them back by using the command prompt. Also, if you have been searching for how to recover corrupted files in flash drive using cmd, then your search is over. This article is a step-by-step guide on how to recover your flash drive files using cmd. I also explore the limitations of this technique and how to work around them.

What is CMD?

CMD is short for command prompt. It is a windows application that enables you to give instructions to your computer using lines of text. After you enter the text, your computer interprets your instructions and executes them.

simple cmd sample

The major benefit of command prompt is that it allows you to access and control your computer’s actions without passing through the Operating System. Also, since it’s a text-only platform, it requires minimal system resources to work.

How to recover files from USB flash drive using CMD

To recover your lost flash drive files, follow these steps carefully:

Step 1. To learn how to recover corrupted files in flash drive using CMD, you first need to plug in your USB Drive to your System. Do make sure if your USB Drive is detected by the System or not. You can also go to, "This PC" and look for your USB Stick to confirm that it's successfully connected to your System.

Step 2. Now, from the home screen, go to the search panel of your taskbar and search for "CMD". Or you can also use the shortcut key "Window+R" to access the "Run" program and search for "CMD". In both cases, you need to access the "Command Prompt" window as an "Administrator

cmd file recovery step 2

Step 3. Once you are on the Command Prompt window, you will have to process in a few commands by typing those commands and pressing "Enter". Type command "chkdsk #: /f" and press Enter to process the command. Before you click the Enter, you need to replace "#" in the command with the Drive letter of your connected USB drive from which you want to recover files.

Step 4. Now, type "Y" and press Enter. You will see the command line starting again. You need to type the Drive Letter again on the command line and press Enter. As soon as the command is processed, the command line will get restored to its initial position.

Step 5. Finally, give the command "#: \ >attrib –h –r –s /s /d *.*" and press Enter ("#" needs to be replaced with the Drive letter). This is the command that will initiate the recovery of all of your files from USB Drive.

cmd file recovery step 5

In the given command "#: \ >attrib –h –r –s /s /d *.*" :

-h applies the Read-Only attribute to selected files.
-s applies System Attribute to selected files.
-h applies Hidden Attribute to selected files.
/S commands the search for specific paths.
/D commands the searching and processing of folders.

Step 6. After the last command is processed, all of your deleted files from USB Drive will be recovered successfully using CMD. You can now access all the restored files at location "attrib -r -s drive:\\" in your storage Drive.

Although Command Prompt is an integrated feature and is capable to recover your deleted files from USB in most cases, it is known to fail in some cases. You cannot always rely on CMD to recover your extremely important data from your USB Drive.

These 6 steps should guide you to recover corrupted files using cmd. If it’s not successful, you could go through them again or keep reading for a better alternative.

Limitations of Command Prompt

Using cmd command to recover files from USB can be effective, but as you may have noticed, it can be quite technical. The process will only be successful if you get all the steps right. Omitting just one letter or putting the wrong punctuation will return an error message.

Additionally, even if you know how to recover corrupted files in flash drive using cmd, the process can be time consuming. Looking at the steps listed above, it will take you some time to type it all.

The cmd method takes so much time because the texts have punctuations that will prevent you from typing as fast as you would like. Besides, you would be trying to avoid mistakes too, adding even more time to the process. In essence, you would be spending a lot of time on a process that has a wide margin for error.

So, what’s the solution? You need a precise and accurate tool that will help you to recover your files without taking so much of your time. To achieve this, Recoverit is the tool you need.

Why Recoverit is the Best File Recovery Solution

There are different kinds of file losses, so you can have different tweaks to the command prompt to address each of the issues. There are more than 1000 different types of file recoveries. How to recover formatted files from USB using cmd is slightly different from the steps you will take to recover hidden files in USB using cmd.

Recoverit helps you to retrieve more than 1000 different types of file losses. It is a fast, precise and accurate tool that requires minimal input from you for a successful file recovery. So, even if you have learnt how to recover flash drive files using cmd, Recoverit will help you save time and ensure that you get a desirable result.

That’s not all. The interface is clear and easy to use. Just a few clicks is all you need and you have all your lost files back.

How to repair your files using Recoverit

Step 1. Storage Drive Selection

First, plug in the thumb drive, and then launch the Recoverit tool. In the tool UI, the first window you will see is the "Storage Drive Selection" window. On this window, look for your USB Drive under the External Devices section. Select the USB Drive from which you want to recover files and click "Start".

recoverit recover files step 1

Step 2. Scanning and Filtering

Now, once the scanning has started, you can filter the scanning process by using many Filters like File Type, Name, Size, etc. located at the right-hand and left-hand panel of the window. After the scanning is finished you will see all of the recoverable files.

recoverit recover files step 2

Step 3. Preview and Recover

You can search for the files or navigate to them. Once you find the files you want to recover, then you can use the "Preview" option to make sure of the file and its quality before recovery. Now select all the files that you wish to recover and click "Recover". Choose a secure location on your System for restoring the files and click "OK".

The very time you will click OK, all of your deleted files from USB will get restored in the PC. You can simply navigate to the location and can access all the files.

recoverit recover files step 3

Reasons for USB data loss

What could be responsible for sudden loss of your files from your flash drive, requiring you to recover corrupted files using cmd?


This can easily affect cheaper USB sticks. The usually cannot handle high temperatures. If you usually use your flash drive in very hot conditions, it will likely get damaged and make you lose your files. So, even if you know how to recover flash drive files using cmd, you may not get the desired result if your flash drive is still too hot.

Excessive force

While inserting or ejecting your flash drive form the computer, avoid applying too much pressure. If you use eject or insert forcefully, you risk damaging the USB connector in more fragile drives. Such action may damage your files such that you’ll need to recover corrupted files using cmd.

Accidental deletion

For one reason or another, you may delete some files by mistake. It’s even easier for this to happen with a flash drive because your files don’t go into the recycle bin. Once you accidentally delete a file from your flash drive, there’s no undo button. You must either use a cmd command to recover files from USB drive or go the easier way – use Recoverit.

Whatever the reasons for losing your files, Recoverit will help you recover them in just 3 easy steps.


You can recover flash drive files using cmd, but it will cost you a lot of time and effort. Recoverit makes this process easy and accessible in just 5 clicks or less.

Recoverit author

Amy Dennis

staff Editor

Home > Resources > Take Data Backup > How to Recover Flash Drive Files Using CMD cloud