Guide: How to Recover Flash Drive Files Using CMD (2023)

Amy Dennis

Apr 10, 2023 • 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.

Guide: How to Recover Flash Drive Files Using CMD (2)

(Video) Recover data From USB Flash Drive and Micro SD Card & External Hardrive use CMD command prompt

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?
  • How to recover files from USB flash drive using CMD
  • Why Recoverit is the Best File Recovery Solution
  • How to repair your files using Recoverit
  • Reasons for USB data loss

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.

Guide: How to Recover Flash Drive Files Using CMD (3)

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

Guide: How to Recover Flash Drive Files Using CMD (4)

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.

Guide: How to Recover Flash Drive Files Using CMD (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.

(Video) How to Fix Corrupted USB Flash Drive and Recover Data?

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.

Download | Win Download | Mac

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".

Guide: How to Recover Flash Drive Files Using CMD (6)

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.

Guide: How to Recover Flash Drive Files Using CMD (7)

(Video) How to recover lost files from USB flash drive using CMD

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.

Guide: How to Recover Flash Drive Files Using CMD (8)

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.

Download | Win Download | Mac

(Video) [How to]Repair a Corrupted Flash Drive using CMD (Command Prompt)

Data Backup Services

Computer Backup
  • Windows 10 Backup
  • Windows 8 Backup
  • Best File Sync Software
  • Driver Backup
  • SD Card Backup
  • Best Incremental Backup
  • Onedrive Automatic Backup
Hard Drive Backup
  • CMD Backup
  • External Hard Drive Backup
  • Hard Drive Backup Software
  • Move Files from C Drive to D Drive
  • Best Backup Hard Drive
Mac Backup
  • Mac Backup Icloud
  • Mac Backup Solutions
  • Top Mac Hard Drive Backup Softwares
Cloud Backup
  • Backup OneDrive Files to External Drive
  • Backup Photos to Google Drive
  • Sync Files Outside Dropbox Folder
  • iCloud Drive Not Syncing on Windows 10
  • Synology Cloud Station
  • Sync Local Folders to OneDrive


Guide: How to Recover Flash Drive Files Using CMD? ›

Step 1: Press Windows +R keys simultaneously, and key-in cmd in the search box. Step 2: in the command line, key in chkdsk G/f where G is the disk letter you desire to recover. Step 4: Again, enter the drive letter, for this case, G and hit the Enter key. The command line will go back to start.

How to use CMD to recover files? ›

Step 1: Press Windows +R keys simultaneously, and key-in cmd in the search box. Step 2: in the command line, key in chkdsk G/f where G is the disk letter you desire to recover. Step 4: Again, enter the drive letter, for this case, G and hit the Enter key. The command line will go back to start.

How to recover formatted files from USB using CMD? ›

How to Recover a USB Hard Drive Using CMD
  1. Open a command prompt by typing cmd in the Windows search box.
  2. Select run as administrator.
  3. Type this command: chkdsk G: /f/x/r. Replace G with the drive letter of the formatted USB drive.
  4. Hit Enter and let the process complete.
May 5, 2023

How to repair corrupted USB drive using CMD? ›

To repair files on a USB flash drive with CHKDSK:
  1. Open the start menu and type “cmd”. Hit Enter on your keyboard.
  2. Enter the following command (make sure to replace DRIVE_LETTER with the letter assigned to the hard drive you want to fix) and press Enter: chkdsk DRIVE_LETTER: /r.
  3. Wait for CHKDSK to finish.
Feb 7, 2023

How do I recover deleted files from a flash drive? ›

Connect your corrupted USB device to your PC or laptop. Go to the folder where you saved your files before they were deleted. Right-click on that specific folder and a dropdown menu will appear. Select Restore a previous version.

How to recover missing files in cmd? ›

How to Recover Files from USB Flash Drive Using Command Prompt
  1. Press Win + R keys and type: cmd, hit Enter to open Command Prompt window as an administrator.
  2. Type: chkdsk E: /f and hit Enter. ( ...
  3. Type: Y and hit Enter to continue.
  4. Type: G: and hit Enter again. ( ...
  5. Type: attrib -h -r -s G:\*.* /s /d and hit Enter. (
Feb 22, 2023

How to recover permanently deleted file by cmd? ›

Recover Permanently Deleted Files using Command Prompt

Step1: Launch the Start menu and type cmd in the Search bar. Step 2: Now, choose and select the Run as administrator option. Step 3: Type chkdsk *: /f in the command prompt window. Ensure to replace * with your hard drive letter and hit the Enter button.

How to recover files from a flash drive that is not recognized? ›

How to Recover Data From USB Not Recognized
  1. Download and install Disk Drill to your computer. Open it.
  2. Select your USB, then click Search for lost data.
  3. Click Review found items once the scan is complete.
  4. Mark what files you want to recover. ...
  5. Choose the output location.
Jan 10, 2023

How do I fix a corrupted and unreadable flash drive? ›

Another way to make a corrupted or unreadable USB drive work again is to format it:
  1. Press Windows + R keys to bring up the Run box. Type: diskmgmt. ...
  2. In Disk Management, locate the unreadable flash drive, check its disk information. ...
  3. Choose a file system like NTFS, FAT32 or exFAT and the Perform a quick format checkbox.
Feb 22, 2023

Can we recover corrupted files in USB? ›

To open files on a corrupted USB drive, you can follow this way: Using CHKDSK in Windows or Disk Utility in macOS to fix the drive's corruption. Then Recover the files with USB recovery tool like Wondershare Recoverit. Note: don't format the USB drive, or all the files stored on it will be wiped out.

How to fix all corrupted files using CMD? ›

The sfc /scannow command will scan all protected system files, and replace corrupted files with a cached copy that is located in a compressed folder at %WinDir%\System32\dllcache. The %WinDir% placeholder represents the Windows operating system folder.

How do I run chkdsk on a flash drive? ›

Steps are:
  1. Connect your Drive with System.
  2. Under search bar, type cmd.
  3. Hit Enter.
  4. Right-click cmd. Exe.
  5. Type in either "chkdsk /X /f USB drive letter:" or "chkdsk USB drive letter: /f " to repair damaged the drive.
  6. At the end, a message: Windows has made corrections to the file system will pop-up.

What is recover command in cmd? ›

Recovers readable information from a bad or defective disk. This command reads a file, sector-by-sector, and recovers data from the good sectors. Data in bad sectors is lost. Because all data in bad sectors is lost when you recover a file, you should recover only one file at a time.

How do I find corrupted files in cmd? ›

  1. Click Start.
  2. In the search bar, type CMD .
  3. Right-click CMD.exe and select Run as Administrator.
  4. On the User Account Control (UAC) prompt, click Yes.
  5. In the command prompt window, type SFC /scannow and press Enter .
  6. System file checker utility checks the integrity of Windows system files and repairs them if required.
Jan 3, 2022

How do I open recovery options in cmd? ›

Open Command Prompt. Type rstrui.exe in the window, and then press Enter. Follow the on-screen instructions to complete the system restore.

Can deleted files ever be recovered? ›

If you can't find a file on your computer or you accidently modified or deleted a file, you can restore it from a backup (if you're using Windows backup) or you can try to restore it from a previous version. Previous versions are copies of files and folders that Windows automatically saves as part of a restore point.

Is it possible to recover permanently deleted files? ›

Windows will write down the previous versions of permanently deleted files. If there are no available previous versions, you still can use this method: create a new file with the same name as the deleted file. Again: “Properties” -> “Restore previous version -> "Restore".

How to recover files from found 000 folder using cmd? ›

So how to recover files from found. 000 folder?
  1. Method 1: Convert Files of Found.000 Folder Into Original Format.
  2. Method 2: Recover CHK Files Using CMD.
  3. Method 3: Restore CHK Files FromPrevious Versions.
  4. Method 4: Recover Data From Found.000 Using AnyRecover.
Mar 30, 2023

How can I recover data from a corrupted USB without formatting? ›

How to Recover Data From a Corrupted Flash Drive Without Needing to Format
  1. Backup Your USB Drive. ...
  2. Retrieve Data With Recovery Tool. ...
  3. Method 1: Try Different USB Ports. ...
  4. Method 2: Repair File System on Your USB. ...
  5. Method 3: Fix Damaged USB Partition with TestDisk.
Dec 7, 2022

How to fix the file or directory is corrupted and unreadable using CMD? ›

In the Start menu search bar, search for command prompt and select Run as administrator. Then, type chkdsk x: /f /r and press Enter. Remember to replace x with your drive letter. Windows will now scan the drive and look for any bad sectors, directory errors, lost clusters, and recover data if necessary.

How to fix disk structure is corrupted and unreadable by cmd? ›

The Disk Structure is Corrupted and Unreadable: How to Fix
  1. Method 1: Reconnect the Drive.
  2. Method 2: CheckDisk (CHKDSK)
  3. Method 3: Scan for Viruses.
  4. Method 4: Update the Drivers.
  5. Method 5: Change the Drive Letter.
  6. Method 6: Reinstall Drive in Device Manager.
  7. Method 7: Formatting.
  8. Method 8: DiskPart.
Nov 22, 2022

How to repair a USB flash drive? ›

How to Fix a Corrupted USB Drive
  1. Open File Explorer.
  2. Go to This PC.
  3. Right-click the corrupted USB flash drive and choose the Properties option.
  4. Navigate to the Tools tab.
  5. Click Check.
  6. Select the Scan and repair drive option.
  7. Wait for the Error Checking tool to repair your drive.
Jan 16, 2023

Can CHKDSK fix a USB drive? ›

You can utilize CHKDSK command to repair hard drives, USB drives, SD cards and other external drives. Runing Windows chkdsk /f command prompt on the flash drive can check file system errors, which are the major cause of corrupted USBs.

How do I know if my flash drive is corrupted? ›

When your USB drive gets corrupted or damaged, you will get an error message like "Please Insert Disk into Removable Disk". The other common errors: "USB Device Not Recognized or Malfunctioned", "you need to format the disk before using it". The error is a clear indicator of a corrupt flash drive controller software.

How do I recover a file that has disappeared? ›

Right-click the file or folder, and then select Restore previous versions. You'll see a list of available previous versions of the file or folder. The list will include files saved on a backup (if you're using Windows Backup to back up your files) as well as restore points, if both types are available.

How do I see all files in cmd? ›

Navigate to the directory containing the folders you wish to appear in your list. Click in the address bar and replace the file path by typing cmd then press Enter. This should open a black and white command prompt displaying the above file path. Type dir /A:D.


1. How to Recover / Format / Remove Virus on a USB Drive Using Command Prompt: A Comprehensive Guide.
(Computer Tech Vision Channel)
2. How to Recover USB Hidden Files Infected by Virus using cmd
3. [Data Recovery] Recover your deleted or formatted data with this command tool
(Technical Santanu)
4. Recover Corrupted Files from USB Using CMD in 1 min
(Tech Hacks )
5. How to Show/Recover Hidden Files on Your Flashdrive/Memory Card Using attrib Command 2017
(Raffy Aguilar)
6. How to Fix a Corrupted Flash Drive and Recover Data?
(Wondershare Recoverit Data Recovery)
Top Articles
Latest Posts
Article information

Author: Dan Stracke

Last Updated: 03/07/2023

Views: 5481

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.