how to recover deleted files using command prompt

Let us cut the chase and go straight to the point. Known as CMD, one of the most common system tool used often by professional specialist for various circumstance. It interpret its command-line into action on all windows OS. Anybody who remembers the DOS system will have a clear view of command prompt and how it works or what it does. It is the very basic of computing and origins of windows system. It provides action through simple computer language or command lines.


I recently deleted many files I am not in use of, then realize that some of the files are quite important or essential to my work, I don’t have any other backup of those files deleted from my PC.
Current CMD is capable with many more features such as; - reference see wiki

How to Recover Deleted Files Using Command Line:

Step 1:

Click on start menu, go to all programs, go to Accessories, select command prompt and open it. or click run, enter cmd.exe, press enter.

open cmd

Step 2

Type chkdsk "drive letter" /f then hit ↵ Enter. This is the first line of code that we are going to use in the recovery process. Make sure that everything is separated with a single space.
ex. C:\Users\TheVirtualWriter>chkdsk E: /f

open cmd

Step 3

After hitting the enter button, type Y to those preceding commands until command line starts again. Do not panic if there are a lot of commands appearing on the cmd window. These commands are one of the process of recovering the file. Just type (Y) to those command questions to proceed.

open cmd

Step 4

Type the drive letter again then hit Enter. [ex. C:\Users\TheVirtualWriter>E:]. The command line will go back to start again after scanning the drive and converting the files inside.

open cmd

Step 5

Type [E:\>attrib -h -r -s /s /d *.*]. This is the last line of command that we are going to use. This will recover everything within the drive.
After typing the code, a new folder will be created on your drive and this folder holds all the photos that are recovered on your memory stick.

Step 6

Copy everything and then change the file name extension from .CHK to .JPG. All the files will be be in .CHK format. They are the recovered files. Just change the file name extension in order the files will appear and recovered. This step need patience because you are going to change them manually one by one.

Warning - CMD Could Make Damage to Data Lost Drive

Since command line can make changes to the drive where data get lost, then it is not 100% safe since there could be data overwritten or disk information changed.

Safer solution - 100% free and safe to use if you do not install the program on the drive where data were lost. iCare Data Recovery Free is able to help rescue deleted files without problem.

Read More

Part2: Powershell to recover deleted files, even the shift deleted files

Examples: recover f:\

powershell recover files

When using 'undelete' command line in cmd Windows PowerShell, it reports that "The term 'undelete' is not recognized as the name of cmdlet, function, script file, or operable program. Check the spelling of he name, or if a path was included, verify that the path is correct and try again."

If it does not work, you may use a Windows data recovery tool to get back data.

Part3: Recover deleted files with free Windows recovery tool when cmd failed

Download iCare Data Recovery Free, install - open it - start recovering deleted files for totally free of charge with easier way to undelete files soon.

recover files

Read More


Starting from MS-DOS, before graphical interface took its place, it was the only operating system running x86-based platform. Many syntax were disables after GUI came out. For instance, “undelete” is one disappeared ever since windows 95.

ms dos recover files

MS-DOS known as Microsoft disk operating system in which its command line system took most of importance, it interprets commands into certain computer actions as its performances. In windows 10, before Powershell taking its all importance, DOS still making its existence at the present time.

powershell recovery

In its latest version, command prompt slowly taking its steps and many new command-line are making its time. For instance, “Netsh” which used to start a network shell(such as managing network configurations of local/remote/computer) has not existed before earlier version of windows and only came out after XP era.


The best is to keep it untouched from CMD since it would be kind of overwriting if you use cmd. If you insist on using cmd for a recovery, the best method is to clone your drive at first, and then you have a backup plan other than data being destroyed by CMD directly without another choice.

For specialists who use CMD often, it is easier to manage command lines on PC. However since Windows does not provide a way back method to draw deleted files back, then a tool would be able to recover files in an instant.

For those advanced users who are lucky to find some shift deleted files with cmd, please note restoring the folder to its previous place is risky. It is kind of damage too if deleted data were not all recovered. Then some lost data would be permanently overwritten if you operate the CMD.

Why Command Prompt?

Provides more detailed error messages than the blanket "Bad command or file name" (in the case of malformed commands) of COMMAND.COM. In the OS/2, errors are reported in the chosen language of the system, their text being taken from the system message files. The HELP command can then be issued with the error message number to obtain further information.

Supports using of arrow keys to scroll through command history. This function was only available to COMMAND.COM via an external component called DOSKEY.
Adds command-line completion for file and folder paths

Treats the Caret character (^) as the escape character; in other words, the character following it is to be taken literally. There special characters in Command Prompt and COMMAND.COM (e.g. "<", ">", "*", "?" and "|") that are part of the syntax and, if specified without caret, can alter the behavior of their command.

Supports delayed variable expansion (Windows 2000 and later), fixing DOS idioms that made using control structures hard and complex. The extensions can be disabled, providing a stricter compatibility mode.

Or improvements such as:

The DelTree command was merged into the RD command, as part of its /S switch.

SetLocal and EndLocal commands limit the scope of changes to the environment. Changes made to the command line environment after SetLocal commands are local to the batch file. EndLocal command restores the previous settings.

The Call command allows subroutines within batch file. The Call command in COMMAND.COM only supports calling external batch files.

File name parser extensions to the Set command are comparable with C shell.

The Set command can perform expression evaluation.
An expansion of the command supports parsing files and arbitrary sets in addition to file names.
The new PushD and PopD commands provide access past navigated paths similar to "forward" and "back" buttons in a web browser or File Explorer.
The conditional IF command can perform case-insensitive comparisons and numeric equality and inequality comparisons in addition to case-sensitive string comparisons. This was available in DR-DOS (by Novell) but not in PC DOS (by IBM) or MS-DOS (by Microsoft).

Related Articles

Hot Articles

Previous: recover deleted files from external usb drive cmd

Next:recover files deleted from recycle bin windows 10

Data Recovery Program > How to recover deleted files using command prompt