Guide: How to Recover Files From Hard Drive Using CMD
What’s the meaning of CMD?

Many people don’t know what the CMD is. In fact, CMD stands for command, and it’s a built-in tool of Microsoft. CMD has many uses, but the most common is to recover data. Only a few people know how to operate it because it’s a bit complicated for average people. In the following article, I will talk about how to recover files from hard drive using CMD, and after that, I believe you can know CMD better.
Using CMD to recover files from hard drive
In the body, there are 3 methods to show you how to recover files from hard drive using CMD, and they are attrib command, CHEDSK and Windows File Recovery.
Recover files by writing attrib command
Attrib command is a good way to recover deleted data because it doesn’t need to download additional software. Not only that, It also can recover the files from USB, HDD, SD card and other external hard drives. In this section, you can figure out how to recover deleted files from hard drive using CMD. The steps are as follows.
Step 1. Enter “CMD” in search bar, and run it as Administrator
Step 2. Type “attrib -h -r -s /s /d C:*.*”. (replace C with the destination drive)

Finally, you can check the original location whether the file is restored.
Restore hard drive files with CHKDSK
Have you ever had data corrupted, and can we fix it? In reality, CMD can help us to complete the file recovery, but do you know how to recover files from corrupted hard drive using CMD? Chkdsk is a useful command-line tool. It can restore the files by entering the command prompts. Now, I will show you the details.
Step 1. Run Command Prompt as administrator.
Step 2. type chkdsk Z: /f /r /x (Z represents the correct drive letter) and press Enter.
Step 3. Wait for the command to complete.

Step 4. After that, enter the following command lines in turn.
Type diskpart and press Enter.
Type list disk and press Enter.
Type select disk * and press Enter. (* is the target drive letter)
Type rescan and press Enter.

Finally, check whether your files are recovered.
Using Windows File Recovery to retrieve files
Windows File Recovery is another way to retrieve files by using CMD, and it’s a software which was published by Microsoft in 2020. It can recover various type of files, such as pdf, image, zip, etc. The difference from other CMD tool is that you must understand some professional computer terms before using it, and I will explain these terms below.
Source drive | where you have lost your files |
Destination drive | the place that you store your recovered files |
Mode | regular & extensive |
Switch | narrow the scanning range |
File system | the way your disk uses to store and retrieve the data |
The command template is like this: winfr source-drive: destination-drive: [/mode] [/switches], and then you should choose each part of them.
Based on the table below, you ought to select the right mode.
File system | Scenarios | mode |
NTFS | Deleted recently | Regular |
NTFS | Deleted for a while | Extensive |
NTFS | Formatted disk | Extensive |
NTFS | Corrupted disk | Extensive |
FAT and exFAT | Any | Extensive |
Next step, you can choose the suitable switch for your command line.
Switches | Meaning | Supported mode(s) |
/n | To filter the scan range: scans for a specific file with its file name/path/type, etc. | All |
/y: | Recovers system files. | NTFS / Segment |
/u | Recovers undeleted files, for example, from the Recycle Bin. | NTFS / Segment |
Eventually, you can type your command line, and wait for a while, your target file will be in your destination drive.
There are 3 ways to show you how to recover files from hard drive using CMD, and it’s not hard to see that they are not user-friendly ways because all of them don’t provide intuitive interface to users. Now, I will display a convenient tool, WinfrGUI. It is more simple and efficient in file recovery due to its graphical interface. People who are not good at computer can use it smoothly through following the pictures. According to the introduction of WinfrGUI, I think you may want to try it. Now, you can click the button below to get this freeware.
Step 1. Choose the range to scan, and then choose a place to restore files.

Step 2. Select the scan mode, and determine the file type in “Advanced settings”.

Step 3. Click the “Start Recovery” button to complete the process.

At the end
Through the post, you will deeply understand how to recover files from hard drive using CMD. But by comparison, you may find WinfrGUI is more suitable for you.
Leave a Reply