Home » Blog » Data Recovery » How to Recover Deleted Files Using Command Prompt? Tricks!
Data Recovery

How to Recover Deleted Files Using Command Prompt? Tricks!

  author
Published By Mohit Jha
Nimisha Ramesh
Approved By Nimisha Ramesh
Published On October 5th, 2023
Reading Time 7 Minutes Reading

recover deleted data from recycle bin using cmd

Command Prompt is the default program, which is used to run various applications by using different commands. It can also resolve issues related to Windows, including external   Drive, Memory Cards, and Flash Drives. It is an alternate way to execute the software. Most of the users tend to use the latest way to run the software on their system, but they never stay away from executing the application using Command Prompt. So, it also helps users to recover deleted files using command prompt, which are lost due to accidental deletion, virus attacks, etc.

Table of ContentsHide

Recover Hard Drive Deleted Files Using CMD? – Users Queries!

Consider the below-given real-time example, where one of the users has deleted files and wants to know how to recover deleted files using a command prompt.

“Hello friends..! I got stuck in a big problem, as my carelessness had cost me a lot. Yesterday, I accidentally deleted some of the most important files. The files that I deleted are very important to me and I need them very much for my work. So I want to restore deleted files using the Command Prompt. To do so, I am searching for software to recover deleted files using Command Prompt and access deleted files again on my computer system. Please help me to recover my deleted files.”

“Hello, My name is Jack Miler, and I am a shopkeeper. I used the external hard disk to store my important documents. Last night, I deleted some files accidentally. Now I want to know how to recover permanently deleted files from an external hard drive using CMD.”

“Is anyone available here to help me? My son deleted data from the hard drive, and I want a free solution to get deleted files back without using the software. I heard about the attrib command but don’t know how to use it. Please suggest a data recovery command prompt.”

There are many users who have faced the same problem as this. So, this article will surely help users find a way to restore deleted files from command prompt files through the command prompt. Before going further, first understand the file structure. A file has two parts:

  • File directory, which contains the file name and the list of blocks
  • The actual blocks which contain the contents or data

When any file is deleted, only the directory is removed, whereas the actual block still contains the data. Thus, the directory records are marked “available” and are invisible to the operating system. In such situations, users can easily recover deleted files using the command prompt.

Few Steps to Recover Deleted Files Using Command Prompt

  1. Download and install a data recovery tool.
  2. Select the hard drive partition where the data was lost.
  3. Click “Scan” and wait for the program to finish scanning.
  4. Preview the recovered data from the software panel.
  5. Select the required data or save complete data.

Methods to Restore Deleted Files from Command Prompt

The command prompt is one of the most impressive methods to recover lost or deleted files from an external drive. The command prompt executes several different commands to perform the recovery task. So, there are some commands given below that can recover lost files:

Before executing the attrib command to recover deleted files. Make sure you are using the right command. Because a wrong step will lead you to a serious problem. Also, the CMD commands are written in the scripting language. So, you have to follow the complete command without any change.

Retrieve Deleted Hard drive Files Using Attrib Command on CMD

If a user has accidentally deleted files from the storage drive, such as USB, flash sticks, hard drives, etc. Then, in order to perform recovery, follow these commands at the command prompt:

  1. First of all, press Windows key + R and type CMD in the search box
  2. After that, in the Command Prompt window, type chkdsk “drive letter”andd& press Enter key
    For example: C: \ USERS\ PROGRAM FILES\ chkdsk D: /f
  3. Now, press Y key until the command lines start again
  4. Then, again, type the drive letter and press the Enter key. Then, the command line will go back to the beginning.
  5. Now, type drive letter: \ >attrib –h –r –s /s /d *.*. This command will recover all the lost files in the storage drive
    Where,
    • is Read-only attribute: Files are readable and cannot be changed.
    • -s is the ‘System’ attribute to the selected files.
    • -h assigns the ‘Hidden’ attribute to the selected files.
    • ‘/S’ assigns to search the specified path, including subfolders.
    • ‘/D’ command includes process folders.

Recover Deleted files using Command Prompt

Finally, when the recovery process is completed, then a new folder is created on your external drive with all the recovered files. Most probably, the files will be in CHK format. Now, change the file format & save the files at the desired location on your system.

Recover Deleted Files from Recycle Bin Using Command Prompt

In some situations, where the recycle bin becomes full, then Windows will delete the files to make space for the recently deleted files. However, these removed files are still recoverable until the recycle bin is emptied.

In order to recover deleted files using command prompt, follow these commands:

  1. First of all, in the command prompt window, type the command start shell:RecycleBinFolder & press Enter key
    For example: C:\> start shell:RecycleBinFolder
  2. Finally, choose the files and recover them.

Note: What if the attrib command fails to recover deleted files? In such a situation, you need a powerful way to get deleted files back from the hard disk. Move to the below section and learn the easiest way to retrieve permanently deleted data from a hard drive.

Retrieve Lost Files When Command Prompt Does Not Help You

Even though users can restore deleted files through the command prompt, sometimes users are not very aware of the commands and are also not very familiar with CMD commands. Also, the command prompt cannot restore deleted files from a formatted storage drive. Therefore, it is suggested to use Windows Data Recovery Software. This tool can help recover the deleted files from the external drive without any hassle.

Download Now Purchase Now

It does not require any familiarity with the command lines. Moreover, it is quite easy to use and has effective utility to recover files deleted by windows defender without any error.

Also Read: How to Recover Hidden Files from External Hard Drive?

Easy Guide to Recover Deleted Files Using Command Prompt

Perform the simple steps listed below instead of performing the hectic attrib command.

  • Download the utility and Install on Windows 11, 10, 8, 8.1,  7, etc.

hard drive data recovery

  • Select the hard disk partition from which files were deleted and hit Scan.

  • Preview complete files after successful recovery.

Preview complete files

  • Save at any location on your Windows computer.

save location

Note: In these simple four steps, you can retrieve lost files without performing CMD commands.

The Final Words

Sometimes, users accidentally delete some imported data. After that, they want to recover them. Thus, this article explains how to recover deleted files using command prompt. Along with the deleted file, users can also restore the formatted data and even restore data from the virus-infected devices in Windows 11, 10, 8, and 7 by using Command Prompt.

If the command prompt does not give an appropriate result, then users can go to the third-party tool. The commercial software is capable of recovering all types of deleted or lost files, that include applications, documents, media files, archive files, etc.

Common User Questions

Q: How do I restore files from the command prompt?

With the help of the above-mentioned blog, you can restore deleted files from command prompt. In this post, we have described an efficient solution to resolve this issue.

Q: How can I restore my deleted files?

With the above Freeviewer software, you can recover deleted, corrupted and formatted data without any file size issues.