How to Recover Data from USB Flash Drive Using CMD [3 Options]
If you are wondering how to recover data from flash drive using CMD, please follow the 3 effective options. In addition, an alternative way which is easier than CMD to recover lost data will be provided too.
Help! Recover data from a flash drive using CMD
How do I restore a flash drive using the Command Prompt?
Hello! I have deleted some files from my flash drive by mistake. I have checked the Recycle Bin but has no clue. Please help me recover the files. Is there any way to recover data from a flash drive using cmd? Thanks."
It is common for users to delete files from their flash drive by mistake, some of which store important information, so many users need to recover data from flash drive by using cmd. Fortunately, there are several methods to help you. If you are not familiar with cmd, try GUI-based data recovery software. You can choose the right way according to your file loss situation.
What is CMD?
CMD, short for command prompt, is the default Windows command-line utility, which can interpret and execute text commands entered by users. It supports different commands, for example, recovering hidden data using cmd attrib, fixing flash drive using CHKDSK command, recovering virus-infected files from USB, etc.
Since it comes along with Windows PC, you don't need to download and install it anymore. If you don't mind using cmd or want to recover files from USB for free, try the following methods to get them back quickly.
How to recover data from flash drive using CMD
If you wanna know how to recover flash drive files using CMD, here are x different choices. Please continue reading to learn the command line for data recovery.
▶ Option 1. Recover data from flash drive with Attrib command
Sometimes your files may be hidden and it usually occurs after virus infection or due to other reasons. It may change the attributes of your files, even the entire directories, making your files seem to disappear. At this time, you can use the attrib commands to regain access to them.
1. First, press the Win + X keys and choose Command Prompt (Admin).
2. Then, type attrib -h -r -s /s /d E:\*.* and press Enter. Replace E with the drive letter where your data was.
-
–h clear the hidden file attribute.
-
–r clear the read-only file attribute
-
–s clear the system file attribute.
-
/s apply command lines to matching files in the current directory and all of its subdirectories.
-
/d apply command lines to directories.
3. Wait a moment and you will gain access to your files. Go to your flash drive and check if the lost are right there.
▶ Option 2. Fix the flash drive using the CHDSK command
Also, the flash drive may be damaged, making the file inaccessible. This usually happens when you transfer files to the same flash drive from multiple systems or using buggy software. Fortunately, you can try the CHDSK command to check the file system and its metadata for logical or physical errors and fix them.
1. Open cmd with administrator priority.
2. Then, type chkdsk E: /r or chkdsk E: /f /r and press Enter. Replace E with the drive letter where your data was.
-
/f fix error on the disk
-
/r fix disk errors, locate bad sectors, and recover readable information.
▶ Option 3. Recover files from USB drive with Windows File Recovery
As a command-line application, Windows File Recovery can help you recover data from USB flash drive, hard drive, external storage, etc. So if you want to know how to recover data from a pen drive using CMD, you can consider using such an application. It is available on Windows 10 2004 and above and does not support network and cloud storage files.
1. Go to the Microsoft Store to download and install Windows File Recovery.
2. Type windows file recovery in the search box and select Run as administrator.
3. Right-click on your flash drive to choose Properties, and check the File system of it.
4. Check the recovery mode and switches.
🔹Recommended recovery modes based on file system and scenarios:
File system |
Scenarios |
Recommended mode |
NTFS |
Deleted recently |
Regular |
NTFS |
Deleted a while ago |
Extensive |
NTFS |
After formatting a disk |
Extensive |
NTFS |
A corrupted disk |
Extensive |
FAT and exFAT |
Any |
Extensive |
🔹Common parameters and switches for winfr:
Parameter/switch |
Description |
Supported mode(s) |
/n |
Scans for a specific file by using a file name, file path, file type, or wildcards. For example:
|
|
/y: |
Recover specific extension groups, comma-separated |
Signature |
/p: |
Saves a log file of the recovery operation in a different location than the default location on the recovery drive (for example, D:\logfile). |
All |
/segment |
Segment mode, recovery option for NTFS drives using file record segments |
Segment |
/signature |
Signature mode, recovery option for all file system types using file headers |
Signature |
4. Type the command according to your need.
For example, if you want to recover the whole folder from the C drive to the D drive, you can enter: winfr C: D: /n \Users\Stephanie\Documents\Test\.
An easier way to recover data from flash drive
As you see, recovering data using CMD is not a simple way for all users. So we also prepared an easier way to recover data from flash drive, hard drive, etc. This effective tool is named MyRecover. It is good at handling different data loss scenarios and has a high success rate as well as fast speed. At the same time, it provides a user-friendly graphic interface, which makes it easy to use, even for novices.
Powerful software to recover flash drive files:
- Two advanced scanning algorithms: It will scan your flash drive quickly and deeply to find all the deleted or lost data in several minutes or longer.
- Compatible with multiple file types (e.g.: documents, images, videos, etc.) and 200+ file formats, such as Word, Excel, PPT, JPG, PNG, MP3, SVG, MP4, WMV, 3FR, X3F, ZIP, etc.
- Highlight features: Filter & locate deleted or lost files on flash drive quickly and preview them. Keep the recovered files with their original filename, format, quality, and path.
- All-inclusive: Recover data from format, deletion, virus attacks, system crashes, etc.
- Support almost all the Windows operating systems including Windows 11/10/8/7, etc., and servers.
1. Open this user-friendly data recovery software - MyRecover. Hover the mouse over the drive and click Scan to scan.
3. Then, it will list all of the deleted files and other missing files after Quick Scan/Deep Scan automatically. You can use the Filter feature to locate specific files quickly.
Type: It will contain all the file types in the local drive, such as images, videos, documents, mails, webpage, compressed files, etc.
Data Modified: It supports today, yesterday, last 7 days, last 30 days, and custom.
Size: It allows you to filter file size from less than 128KB to 128KB ~1MB to 1MB ~ 512MB and above, or custom.
4. Next, check the scanning result and select the desired files. Click on the Recover X files button and select a new location to begin the recovery task.
- You don't need to wait for the scanning process to complete. If you find deleted or lost files, you can directly select and recover them.
- Don’t recover deleted files to their original location. Doing so will overwrite the space where the deleted files were stored and cause the data recovery to fail.
- Besides, you still can use it to perform SD card data recovery, external hard drive data recovery, etc.
- To recover unlimited files, you need to upgrade MyRecover to the Professional or Technician edition.
Final thoughts
That’s all about how to recover data from flash drive using CMD. You can choose to use the built-in commands, such as attrib, CHKDSK, or Windows File Recovery. At the same time, we introduced an easier way to recover flash drive data - MyRecover. You can recover any type of data via it without effort. Just go to have a try.
Anyway, if you don't want to lose any data in the future, it's suggested to backup files on flash drive automatically. Free backup software for Windows - AOMEI Backupper Standard is worth trying. It not only offers you the feature to backup files automatically but also backup only changed files.