By Penny / Last update May 10, 2022

Reasons for using command prompt

It’s all known to us that physical damage to storage devices or accidental deletion may cause data loss. Sometimes you want to get the deleted or corrupted files back. But how to recover?

The command prompt is a solution. With powerful functions, you can use CMD to deal with all the regular things such as copying, deleting files and folders, change settings. One of the most exciting features is that you're allowed to recover the deleted/lost files using CMD.

How to recover deleted files using command prompt?

How to recover deleted files using the command prompt? Let’s begin with CMD. It is also known as Command Prompt or CMD, referring to the default command-line interpreter application on Windows. The name refers to its executable filename. This program uses a command-line interface to interact with users.  So how to recover my files using CMD? Please scroll down. 

Method 1. Recover hidden files using command prompt

You’re supposed to check your Recycle Bin first before using the command prompt. Recycle Bin can save your deleted files for an available period. Maybe you can restore your deleted files from recycle bin during this period.

If you have emptied Recycle Bin or the file recovery time has exceeded, the tips above certainly don’t work. Then how to recover deleted files using command files? Let’s take Windows 10 for example. Here are the explicit instructions below.

Step 1. Press Windows + X keys, then select “Windows PowerShell (Admin)” for Windows 10.

Step 2. In the Command Prompt window, type chkdsk ‘drive letter’:/f and press the "Enter" key.

("drive letter" refers to the certain drive containing deleted files. For example, it’s G drive below)

chdsk-cmd

Step 3. Press "Y" and wait for the command line to finish. Then type the drive letter again and press "Enter".

Step 4. Type "attrib -h -r -s /s /d *.* "and press "Enter". Please wait for the process to finish.

attrib-cmd

Maybe you are wondering about the meaning of these parameters in the attrib command, please scroll down to read.

▶-h: gives the Hidden attribute to the files specified.

▶-r: refers to the read-only attribute

▶-s: gives the System attribute to the files specified.

▶/s: tells the system to search the specified path (including subfolders).

▶/d: consists of process folders.

Method 2. Recover deleted files with Windows File Recovery

Compared with CMD, you might be more familiar with Windows File Recovery working on file recovery. Windows File Recovery is a command-line software program from Microsoft without GUI. This program needs to work with Windows 10 2004 and later. In the Windows file system, we usually regard the space covered by the deleted files as free space.

If you want to use Windows File Recovery to recover the lost files, please avoid using your computer to increase the possibilities of recovering the deleted files and folders. Because it’s impossible to retrieve if the free space has been overwritten by new data. This utility has 4 modes. These are Regular, Segmented, Signature mode, and Extensive mode. You can follow the respective steps below.

   Notes: 
  1. The basic command format: winfr source-drive: destination-drive [/mode] [/switches]
  2. Ensure your recovered files will be saved in another location rather than the scanning partition.
  3. Click "This PC" and right-click on the source drive that includes your needed files before deletion. Then click "Properties" to check your file system. 

check-file-system

Step 1. Download and install Windows File Recovery from Microsoft Store on your PC.

microsoft-store-get

Step 2. Search Windows File Recovery in the search bar and click "Run as administrator".

windows-file-recovery-run-as-adminstrator

Step 3. Select a suitable mode after checking your file system.

File system

Circumstances

Recommended mode

NTFS

Deleted recently

Default

NTFS

Deleted a while ago

Segment, followed by Signature

NTFS

After formatting a disk

Segment, followed by Signature

NTFS

A corrupted disk

Segment, followed by Signature

FAT and exFAT

Any

Extensive

Step 4. You can resemble your command line with common General and Advanced syntax. 

General syntax

Parameter/switch

Description

Supported mode(s)

/regular

Regular mode, the standard recovery option for non-corrupted NTFS drives

Regular

/extensive

Extensive mode, a thorough recovery option suitable for all file systems

Extensive

Advanced syntax

Switch

Description

Supported mode(s)

/ntfs

NTFS mode, a fast recovery option for healthy NTFS drives using the master file table

NTFS

/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

For instance, if you want to recover the targeted file from the C drive to the E drive, the command line is Winfr C: E:/n \Users\ \Documents\QuarterlyStatement.docx

Step 5. Enter “y” to continue and wait patiently. Then your recovered files will be saved in the destination drive you’ve chosen.

Recover deleted files using free WinfrGUI

To some extent, it might be difficult for novices to enter the correct command line without GUI. At the moment, you can try this alternative method for file recovery using WinfrGUI (Windows File Recovery GUI). This free tool enables you to troubleshoot many issues like recovering the deleted files without command lines in Windows 10/11. You can refer to the following steps with this program.

Download Freeware Win 10 2004 and above
Secure Download

Step 1. Download and install WinfrGUI on your computer. Then select a partition to scan and a destination place to store the recovered files.

select-a-partition-to-scan

Step 2. You can choose Quick Scan or Deep Scan. Then go to “Advanced Settings” and select the files type and folders you want.

choose-scan-mode-to-recover

Step 3. Click “Start Recovery” to scan. After the process, your recovered files will be saved in the destination drive.

click-start-recovery

Recover deleted files using AOMEI Data Recovery for Windows

If you later regret using WinfrGUI, you could discontinue using it and seek help from the more powerful AOMEI Data Recovery for Windows. The highly-praised reputation of this Windows data recovery software rests on its functionality and user-friendliness. 

 In brief, you're allowed to recover the deleted/lost files in Windows 11/10/8/7 and Windows Server because of its higher data recovery rate and good compatibility. Moreover, it's possible to keep the original path, file names, and format for the deleted files from SSD/HDD/USB and other storage media. 

Other highlights of AOMEI Data Recovery for Windows:
☁Handle accidental/intentional deletion, disk formatting, system crash, or other data loss scenarios. 

☁It offers good coverage of 200+ types of data: Word, PPT, Excel, Photos, Audios, Videos, Emails, Webpages, and Compressed files.

☁The combined scanning method of Quick Scan and Deep Scan can search all the deleted files and other lost files. 

Download SoftwareWin 11/10/8/7/Server
Secure Download

Step 1. Install and run AOMEI Data Recovery for Windows on your PC. Then select the partition/disk including your needed files before deletion, and click "Start Scan".

select-a-partition-to-scan

Step 2. The software will run Quick Scan and Deep Scan automatically. Then you'll see all the deleted files and other lost files after searching.

scan-lost-data

Step 3. Confirm the scanning results and click "Recover x files". Then locate a destination place to save these recovered files. 

recover-lost-data

In conclusion

There is no denying that CMD is a useful tool, helping you address all sorts of issues such as managing your deleted drive, formatted drive, or flash drive. In addition, you can also recover deleted files using Windows File Recovery. If you want to improve the efficiency of file recovery and retain the original file names and format, Windows Data Recovery for Windows could be your best option.