How to Recover Deleted Files Using Command Prompt (CMD)?

Deleting files to create space for others is a normal thing for most people. There are instances where the deleted files suddenly become important and people go into frantic effort to get them back. In some other instances, files are mistakenly deleted permanently from a device, putting the individual in a very critical condition. If you are looking for how to recover deleted files using command prompt, this is the right place to be.

1How to Recover Deleted Files Using Command Prompt

Command prompt is one of the most powerful inbuilt utility tool in a computer. It can be used to troubleshoot most issues relating to windows including recovery of deleted files from external hard drive, flash drives, memory cards and other storage devices.


If you have lost some files by any means, here is how to recover files from external hard drive using command prompt.

Steps to Recover Deleted Files from External Hard Drive using CMD 

Step 1: Press Window key + R and type CMD in the search box

Step 2: In the Command Prompt window, type chkdsk 'drive letter' /f and hit Enter

For example: C : \ USERS\ PROGRAM FILES\ chkdsk D : /f

Step 3: Press Y until the command lines start again

Step 4: Type the drive letter again and press Enter (This will take the command line back to start)

Step 5: Type [drive letter : \ >attrib -h -r -s /s /d *.*]. This command will recover all the files in the storage drive (attrib -r -s drive:\\)


  • -r is Read-only attribute: Files are readable and cannot be changed

  • -s assigns 'System' attribute to the selected files

  • -h command assigns the 'Hidden' attribute to the selected files

  • '/S' implies to search the specified path including subfolders

  • '/D' command includes process folders

Step 6: If the files are in .CHK format, change the file format and save the files at the preferred location.

2How to Recover Deleted Files Using Attrib Command

When files are deleted from external storage devices plugged into a computer, the files will not be found in the recycle bin. Such file will be difficult to recover and that is where the Attrib command comes in.

Steps to Recover Deleted Files Using Attrib Command

To recover deleted files follow the step below:

Step 1: On your Windows PC, click the 'Start' button

Step 2: Type 'CMD' in the dialogue box and press 'Enter'

Step 3: Type in chkdsk F: /f and press Enter

Step 4: Type in Y and press Enter

Step 5: Type F and press Enter

Step 6: Type in F:\>attrib -h -r -s /s /d *.* and press Enter


Note: 'F' as mentioned throughout the steps represents the drive letter of your external hard drive where you want to recover lost file. When the deleted file is recovered, it will be saved in a newly created folder in your external hard drive.

3How to Recover Deleted Files without Using CMD

Asides from using CMD to recover deleted files, there are other methods that can be used. Using command prompt is actually a challenging process that requires familiarity with technical skills. It will also not recover files from formatted storage drive. If you are looking for alternative methods of recovering lost files, iMyFone AnyRecover is a great software to use.

iMyFone AnyRecover offers a set of impressive features including the following:


1,000,000 + Downloads


  • The software works great for 1000+ file types including pictures, images, videos, documents, audio files, emails and archives.

  • Recover data from different types of storage devices including internal hard disk, external hard drive, phone memory, camera memory, USB drive, memory card and more.

  • Work in every data loss scenario. No matter the cause of the loss from your storage device, you can get back the file.

  • This is one of the most powerful data recovery software - Over 98% Recovery Rate

Download NowDownload Now

How to Use AnyRecover for Deleted Files Recovery

Step 1. Open the AnyRecover application and choose a disk under the “Hard Disk Drives” tab or Desktop under "Common Location" tab from where the files were deleted.

select location hard drive

Step 2. After choosing the location, hit “Start” button to start scanning process.

start scan

Step 3. After the scanning process, AnyRecover will display all the files that has been recovered. Select the files you want to retrieve and preview them. Click on the "Recover" button to get your files back.

scanned files preview


File deletion can happen by accident. Here, we have covered how to recover files from external drive using command prompt. We have also considered the most effective way to achieve that without using CMD. The software, iMyFone AnyRecover is a trusted tool that you can use to recover deleted files without command prompt.

Download NowDownload Now

+ View all all the comments and join the discussion


By  Simon Marcus , to Deleted Files Recovery

Posted on Jun 25, 2019  ( Updated: Jun 01, 2020 )

Related Articles: