By Lora / Last update May 11, 2022

Scenarios of hard disk data loss

hard-disk-drive

While using the hard drive, users tend to meet situations like partition or data loss due to inadvertent deletion or so. When it comes to data loss, seas of users may have their stories to tell. Let’s see some cases below.

I have deleted 2GB from my documents by mistake. I only deleted the folder and its content from my documents and then emptied the recycle bin. Is there a professional software paid or open-source that can recover the deleted items, please?

- Question from Spiceworks

Users always encounter hard drive recovery issues. These users ran into a similar situation, and now they are wondering whether the deleted data is irreversible and unrecoverable.

It can be easily inferred that plenty of users is hurry to know is it possible to recover hard disk data using CMD. Now find the answer in the next part below.

Is it possible to recover data with CMD?

As a quite useful inbuilt tool utility on Windows, Command Prompt indeed can enable users to solve their hard drive recovery issue.

Command Prompt, commonly referred to as CMD/cmd.exe, is a default command-line interpreter users can utilize on Microsoft Windows 10/8/7/Server 2003/Vista/XP and other OS.

When running CMD, users can operate or interact with the system, including managing disks, retrieving documents, fixing bad sectors, and so on. As for the files deleted, they are indeed recoverable. When the OS deletes a file, it just removes it from the allocation table.

At this time, the first letter of the file name in the disk storage area will be wiped, and the space used by the deleted file is marked as free space, but the file content itself will not be erased immediately, which means that the file data can still exist and can be restored.

Then how can users recover data from hard disks using Command Prompt? Check it out in the solution part as follows.

How to recover files using Command Prompt?

To utilize this useful inbuilt tool, users can follow the steps below to retrieve data from hard disk.

Method 1. Recover hard disk data using CMD

You could utilize the in-built tool Command Prompt to get files or data back. It is used to remove or modify the attributes of files, and thus to let hidden files, read-only files, etc. be "recovered". So the recovery rate is relatively low.

Notes:✎...
Press Enter every step to commit your operation.
Input help to get information about the command name and function of all the command lines. To dig further, input help 'command-name' to get some more info on specific command lines.

This tool only fits the situation where your files are hidden or unchangeable and it is not recommended for those who do not possess computer expertise.

Step 1. Input cmd in the search bar of Windows, then choose Run as administrator.

Step 2. Now you are in the Command Prompt interface, input chkdsk x:/f. Here x refers to the drive letter of the disk in which your lost data was stored.

Step 3. Input the drive letter again. Then input attrib –h –r –s /s /d diver-letter: \*.*.

attrib-cmd

Here the command line “attrib” enables users to view or change the attributes of the files.

-” means clearing the attribute;
/s” enables users to process matching files in the current folder and all subfolders.
/d” supports users to process folders as well.
h” means the hidden file attribute;
r” means the read-only file attribute;
s” means system file attribute.

Thus you have performed hard drive recovery by removing the hidden attributes of the data.

Though this inbuilt tool of Windows is quite powerful, it can be pretty dangerous for those who do not possess some troubleshooting experience and computer expertise.

Once an individual step or line gets input wrongly, users may carry out an improper operation, leading to severe results like further data loss or device malfunction.

Method 2. Recover files using command prompt via Windows File Recovery

If you experienced some hiccups while using CMD or found it does not function well, it is strongly advised and recommended for you to take advantage of this tool - Windows File Recovery.

As an official tool developed by Microsoft, it can provide a relatively high recovery rate. Using this tool you could recover deleted or lost files on external/internal hard drives in Windows 10 2004 and later.

Notes:✎...
Please avoid using your computer after an unintentional deletion to avoid overwriting files.
If you meet the error "failed to create destination folder" in Windows File Recovery, please get help.

Using this tool requires users to pick a recovery mode and switches. To get a more detailed introduction of modes and switches, please refer to "How to use Windows File Recovery". It provides two basic modes: Regular & Extensive;

 Two advanced modes are also available: Segment & Signature. Segment only supports file recovery on hard drives using NTFS, while Signature can recover files under all File Systems.

To decide which mode to use, you need first to check the File System your hard drive is using.

Go to This PC> locate the hard disk where your files are lost > right-click on it > Properties.

check-file-system

Then this chart will help you decide the recovery 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

Parameters are available for folder filter, too.

Switches Meaning Supported mode(s)
/n Filter the scan range: scans for a specific file with its file name/path/type, etc. All
/y: Recover specific extension groups. Signature
/k Recovers system files. NTFS
Segment​​​​​
/u Recovers undeleted files, for example, from the Recycle Bin. NTFS
Segment

Now follow the guide here.

Step 1. Install Windows File Recovery from Microsoft Store.

get-windows-file-recovery

Step 2. Run it. Instructions are shown on the window. Input the recovery command:

winfr source-drive: destination-drive: [/mode] [/switches]

For instance, if you need to recover Excel files from C: drive to E: drive, and the files are deleted several days ago, then you should take advantage of Segment mode.

winfr-segment-xlsx

Step 3. Then after the processing, a folder named Recovery will be created automatically in the target place.

Some users may find it too complicated to use Windows File Recovery because commands are so difficult to handle.

Then for these users, a file recovery tool with a graphical user interface could be of great help. To recover deleted files from SD card using this tool is also feasible.

WinfrGUI - Windows File Recovery freeware

Helps users recover lost files in Windows 10/11 effortlessly within just a few clicks.

Download Freeware Win 10 2004 and above
Secure Download

Using this tool, you could recover office /media/compressed files and so on, including jpg/png/mov/pdf/docx/xlsx/zip, etc.

Notes:✎...
This software only supports Windows 10 and above. 
WinfrGUI completely invokes the function of Windows File Recovery, promising no guarantee of 100 % successful file recovery. 
Use Deep Scan to recover files on non-NTFS hard disks. 
The destination partition/drive must be different from the source partition.

Step 1. Install and run WinfrGUI > locate the source partition (where you have lost files) > select a target drive (where you would like to store the recovered files).

select-a-partition

Step 2. Choose a scanning method. Deep Scan can last for a while, please wait in patience. Advanced Settings are available if needed.

choose-scan-mode

Step 3. Click Start Recovery to get files back with ease.

start-recovery

Method 3. Recover files from hard drive at a high recovery rate

Command Prompt as a command-line app that provides no graphical user interface, sets a barrier to users. What's more, only Windows 10 users can utilize Windows File Recovery and WinfrGUI.

Then, for those who are using Windows OS under Windows 10 and don't know much about commands, how to restore data from hard drives easier? You might as well let AOMEI Data Recovery for Windows help you.  

♦ AOMEI Data Recovery for Windows

Recover deleted or missing data efficiently and easily within only 3 simple steps 

  • Restore deleted files and meanwhile keep their original file formats, filenames, and file paths.
  • Restore more than 200 types of data, including photos, texts, docs, charts, zip files, etc.
  • Support data recovery during the scanning process - no need to wait till it ends.
  • Highly compatible with Wide Windows OS from 7 SP1, 8, 10, to 11.
Download SoftwareWin 11/10/8/7/Server
Secure Download

Step 1. Run AOMEI Data Recovery for Windows > select the disk/partition where you have lost data > click Start Scan.

select-a-partition-to-scan

Step 2. The software will automatically scan the partition with Quick Scan & Deep Scan to locate the deleted and other missing files.

scan-lost-data

Step 3. Select the files you need > click Recover x files to store your deleted or lost data.

recover-lost-data

Using this tool can free you from difficult commands and save your precious time. Also, it is feasible to restore permanently deleted files from hard drive using this utility.

Summary

On this page you can find a detailed introduction about how to recover data from hard disk using Command Prompt, what’s more, steps to operate a recommended alternative are provided as well.

Compared with performing hard drive recovery, taking precautions is much wiser for users to do so. As an old saying goes, repairing the house before it rains is always the best bet. The top priority for users to use their devices is to form a habit of making a backup of their valuable data.

To carry out this precaution, you may as well utilize a third-party tool AOMEI Backupper, whose easy-to-operate inbuilt tool “System Backup”,  “Disk Backup”, “File Backup”  etc. facilitates users to backup their cherished data and prevent future risks.