Guide: Use the Recover Command in CMD to recover deleted files

How to use the Recover command in CMD to recover deleted files? This article gives a detailed guide to help you use it and get your files back.


By Lora / Updated on April 3, 2024

Share this: instagram reddit

The majority of users cannot escape from data loss on hard drives. When meeting data deletion, missing, formatting, etc., many will search for remedies on sites and forums to rescue their data.

And you may wonder how to recover data from hard disk using command prompt. For instance, you need to recover flash drive files using CMD, and now you wonder how to achieve it.

Perhaps you will learn that Command Prompt commands, like “recover”, “attrib”, “chkdsk” commands, etc., can help you restore your deleted or missing files.

But those commands are quite demanding and pretty difficult to use.



How do I word the recover command? It is looking for disk, path, and filename. I believe the name I entered is right, but I don’t know where the file should reside.


- Question from TechSupportForum


Don’t panic, this article will explain and introduce the usage of the “recover” command in CMD. With the guide here, you could use CMD to recover deleted files successfully.

What is Recover command in cmd?

The “recover” command is one of the commands in Command Prompt. According to Microsoft, it is used to restore unimpaired/undamaged data from a defective disk.

When executed, it scans the hard disk sector by sector and restores data from the good sectors.

The syntax goes like this:

recover [drive:][path]filename

The parameters used here respectively represent:

Drive: the hard drive where the file was stored.

Path: the exact directory.

Filename: the exact filename. Must be 100% correct.

Can the Recover command be used to restore a deleted file?

Of course yes, just as mentioned above, the Recover command will try to restore the readable information on a hard drive.

By scanning sector by sector, it can restore intact data from a defective hard drive, but omit the corrupted/lost data in bad sectors.

Check its edges and shortcomings.

✐ Edges:

  • Restore data without doing any damage or influencing your hard drives.
  • You could get support from Microsoft.

✐ Shortcomings:

  • Too demanding: requires the exact filename and path.
  • Too ineffective: only restore 1 file at a time.
  • No wildcards are supported in the syntax.

Now, with the knowledge of the Recover command, let’s move on to the part: how to recover data from hard disk using command prompt - “recover”.

How to use the Recover command in CMD to recover deleted files?

This command is not too difficult but really demanding in data recovery. So there is no guarantee of success rate. Follow the steps here to use the Recover command in CMD.

The exact filename and path are required in the syntax. 
Wildcard like “*” will be invalid and could not be utilized.

Step 1. Start Command Prompt by inputting cmd in the Windows search box > choose Run as administrator.


Step 2. Input diskpartlist disk > select disk 0 > list volume > select volume 1. Please replace the number here with the real drive letter of your affected drive.

Step 3. Input recover [drive:][path]filename. Specify the parameters according to your specific situation.


E.g., if you want to recover a picture stored in a folder named “photos” on the desktop, you could input:

recover c:\photos\travle01.jpg

Thus, you could use the Recover command in CMD to recover readable info from the affected hard drive.

To tell the truth, it is too demanding – it required the 100% correct filename and the directory to get your files back, which sets barriers for most users to restore their precious data.

Then, is there any easier way to recover deleted or lost data?

How to recover deleted files in Windows 10 directly without commands?

Compared to catering to the rigorous requirements of the “recover” command, sagacious users would rather save their precious time and labor by recovering lost data directly without commands.

In this case, you could rely on a professional Windows data recovery tool to assist you. To pick one from considerable data rescue tools, you could check these features that a good data recovery tool should possess.

Restore various types of data/files. 
Support data recovery from HDD/SSD/USB/SD card, etc. 
Restore data with a high recovery rate and at a high speed. 
Compatible with various operating systems and file systems. 

Among so many tools, MyRecover is one of the best Windows data rescue utilities that meet all these requirements.

It scans the hard disks for 200+ types of data, supporting Windows 11/10/8/7 SP 1, etc., and NTFS, FAT32, exFAT, ReFS, etc.

Working perfectly with all storage devices, it makes SD card recovery an easy task. What’s more, it can restore and keep the original formats, filename, and paths of the deleted data.

Download MyRecover to start easy data recovery without the difficult Recover command in CMD.

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

Step 1. Install and run the software > hover the mouse over the drive, and click Scan.


Step 2. Wait for the scanning result or select files to restore directly.


Step 3. Go to Deleted files > navigate to its original location > choose the files you need > click Recover x files.


Thus, you could directly and effortlessly restore data from Windows 10/8/7 and 11 without the Recover command in CMD. Also, as a versatile tool, it can restore data from formatted hard drives.

FAQ: commands used to recover files

In this article, the syntax, usage, advantages, and disadvantages of the Recover command in CMD are elaborated on. In addition, a good data rescue tool that can free you from difficult commands has been introduced as well.

Actually, backing up your important data will be the most safe method to prevent you from data loss. Utilize the professional data backup tool AOMEI Backupper to guard your data.

In case you may have some more questions about commands. Extra info is ready here to help you.

What are the attrib commands? Can I use the attrib command to recover deleted files?

If you are searching for methods of how to recover data from hard disk using Command Prompt, you might learn that the "attrib" commands "can" recover files.

The “attrib” command is used to show, remove, or give attributes to files. It needs to be used with parameters like /r, /s, /d, etc.

Different parameters work differently on files. Users need to use “+” or “-” with the parameters to give or remove the attributes.

/r: Assign or remove the “Read-only” attribute to files. 
/h: Give or remove the “Hidden” attribute to files. 
/s:   Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories. 

Among multiple “attrib” commands, no one can restore deleted files, but just show some hidden files, cancel the “Read-only” flag, etc. 

Will CHKDSK delete my files?

The “chkdsk” command will check the file system and the metadata in it to see if there are any errors. It also needs to be used with parameters like /f, /r, /x, or /b to fix the errors.

In general, it just checks the hard disks for physical or logical errors, and won’t disturb or interfere with the files in the hard drives.

But sometimes, due to other issues, like hard drive corruption, your files could get lost. Try to use MyRecover to seek the lost files you need.

Does Windows Scan and Fix delete files?

Some users are wondering does Windows Scan and Fix delete files, actually, it will automatically show up when there might be some errors or bad sectors on the plugged USB/SD card. It is used to fix the errors.

The same, your files might get deleted or removed due to a virus attack, so you may find files lost after Scan and Fix.

In this case, you could use MyRecover to scan the missing files on your hard drives.

Lora · Editor
Lora is an editor of AOMEI Technology. She is also a tester and editor of AOMEI Data Recovery Tools. -- "Keep testing, write the most useful tutorials for helping people recover the lost data for Windows and phones" is the most meaningful thing for her. Dedicated to creating helpful tutorials, she hopes her tutorial can assist users to effortlessly solve data loss problems on their personal computers and mobile phones.