How to Recover Deleted Files Using Command Prompt?

Updated on July 7th, 2021

Rohit Arora
How to recover deleted files using command prompt

Summary: Now day's there are many methods available to recover deleted data. And the most affordable way to recover data is via using command prompt however, it is little technical. This guide has detailed steps you need to follow for recovering data using command prompt.

How to Recover Deleted Files Using Command Prompt?

Command Prompt can troubleshoot certain issues related to Windows including external hard drive recovery, memory cards and flash drives recovery. Being one of the most powerful inbuilt utility tool, it helps users to retrieve the files  lost due to accidental deletion, virus attack. Along with it, Command prompt repairs bad sectors on storage devices and convert Raw File System to NTFS for free. So if you have accidentally deleted or lost files, you can simply use Command prompt to recover it.

File Structure:

Before going further let’s understand the file structure first

A file consists of two parts:

A directory which consists the file name and the list of the blocks
✓ The actual blocks which contain the data

When a file is deleted, only the directory is removed whereas the actual block if not overwritten or modified, still contains the files. Thereby, the directory entries are marked ‘available’ and are hidden from the Operating System. In such cases, you can easily recover your lost files using the command prompt.

Recover your files using Command Prompt:

One of the most effective methods to recover deleted files from the external drive is through Command Prompt. Command Prompt executes commands to perform the assigned task. That said, there are some commands, which can recover your deleted files. They are as follows:

1. Recover files from your external drive

If you have accidentally deleted files from the storage drive such as hard drives, USB, flash sticks etc. Follow these commands in command prompt:

i. Press Windows key + R and in the search box, type CMD
ii. In the Command Prompt window, type chkdsk ‘drive letter’ /f and hit Enter.
For example: C : \ USERS\ PROGRAM FILES\ chkdsk D : /f
iii. Press Y until the command lines start again
iv. Type the drive letter again and hit Enter (The command line will go back to the start)
v. Now, type [drive letter : \ >attrib –h –r –s /s /d *.*]. This command will recover all the files in the storage drive (attrib -r -s drive:\<path>\<foldername>)
Where,
–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

cmd window

vi. Once the process is complete, a new folder is created on your external drive with all the recovered files. Probably, the files will be in .CHK format. Change the file format and save the files at the preferred location

2. Restore files from Recycle Bin using Command Prompt:

When the Recycle Bin becomes full, Windows deletes files to make space for the newly deleted ones. However, these removed files are still recoverable until the Recycle Bin is emptied.

Follow these commands to restore files from Recycle Bin:

i. In the command prompt window, type: start shell:RecycleBinFolder and press Enter
For example: C:\> start shell:RecycleBinFolder
ii. Select the files and restore them

Recover files when command prompt does not help you

Even though you can recover deleted files through Command Prompt but the prerequisite is that you must be familiar with technical jargons. The reason being, you have to type in many commands and if you’re not familiar with the command lines, then it may seem complicated.

Furthermore, Command Prompt cannot recover files from a formatted storage drive, for that you need to leverage an external drive recovery software. Stellar Data Recovery- Standard for Windows software can assist you in recovering your deleted files from the external drive hassle-free. It doesn’t require any familiarity with the command lines and is quite easy to use.

Watch this video to see how easily Stellar Data Recovery- Standard for Windows recovers lost or deleted data

Afterpiece

You can perform advanced administrative functions via Command Prompt. But you need to get familiar with each parameter and how they can be combined to achieve the desired result. Sometimes, the process gets complicated. On similar lines, recovering deleted files should be a simple and hassle-free process and that is when Stellar Data Recovery- Standard for Windows rises to the occasion.


About The Author

isha

Isha is a technical blogger and data recovery expert. She has experience in Windows data recovery. She writes about technical tips and tutorials. 

Best Selling Products

Stellar Data Recovery Professional

Stellar Data Recovery Professional softw Read More

Stellar Data Recovery Premium

Stellar Data Recovery Premium for Window Read More

Stellar Data Recovery Technician

Stellar Data Recovery Technician intelli Read More

Stellar Data Recovery Toolkit

Stellar Data Recovery Toolkit is an adva Read More

Total
37
Shares
30 comments
  1. Need HELP!!! I delete a large amount of avi files stored in a 2TB external drive by accident. I have not touched that 2TB drive since deleted them. I wanted to use the Command prompt described in this article to bring those files back but wanted to write those recovered files to another external drive as I don’t want to overwrite in that 2TB drive just in case if anything goes wrong and I can redo it again or use a recovery software to do it. Do you have that command or I must recover those files back to the same drive? Many thanks for your help!!!

    1. The command is for an inaccessible or corrupt drive where the file system gets damaged. In your case, since you have accidentally deleted data, you must use Stellar Data Recovery software to get back your AVI files. To make things faster, choose videos from the options in software while scanning the storage media. It will help you recover AVI files faster.

  2. Hi Isha, I am suffering from the same problem. I tell you the whole incident,
    3 days ago i saw an option in Computer=>Properties that “compress files to save space”, as I had not enough space on my hard disk, so i checked this bOx. A process started to compress the files of both local disks (C and D).
    Next time i started my pc it said
    “bootMGR is comressed Press LSHIFT+CTRL+Delete to Restart”.
    I got horrified with this note. I knew that all this happened due to that compression process. I inserted window disk in pc and from repair i opened command prompt=>diskpart and after selecting hard disk i entered .’clean’ command. I thougt that this command will restore that compession task.
    But all my hard disk was cleaned and ‘unallocated space’ name appeared..so i lost all my data from hard disk. Then i just installed window on my pc and that “unallocated space” changed to “Local Disk C” …That data meant everything to me, I collected that data from last four years. I have tried to recover my data from some softwares but all are demanding money ($) for activation to use that software… Kindly tell me how to get that data back fully. From command panel or any recovery software that does not demands money. As I dont have any money, I am a Student… Please help me recover all my data (all happened due to diskpart clean command)…kindly email me the way.. As i cant come to this website again and again.please help me

  3. Frankly speaking it is very hard to recover deleted files for average human being. I almost lost my senses when the horrible black screen arrives in front of my eyes. A very good alternative to this is user-friendly interface of Stellar Data Recovery Professional software.

  4. I’m trying to recover video files from my SD card. I’ve followed the steps and just to be sure specified the DCIM folder. When I hit enter on:

    F:\DCIM\112D7000> attrib -h -r -s /s /d *.*

    I get: File not found – *.*

    What am I doing wrong? What’s the *.* part of the command?

    1. Hello Ric,

      We would recommend you to select SD Card directly in our software and select file types which you want to recover. Then, start the scanning process in order to check the possibility of data recovery.

      Also, let us know the reason of data loss so that we can assist you further.

Leave a Reply

Your email address will not be published. Required fields are marked *

83  −    =  74

Related Posts