[Step-by-Step Guide] Using Command Prompt Recover Deleted Files

Using Command Prompt recover deleted files is a great way to retrieve lost files on your Windows. Also, there is simpler solution for data recovery on PC.

Posted by @Lucas December 17, 2024 Updated By @Lucas December 11, 2024

Windows Command Prompt offers a dependable method for recovering files from practically all storage media, including memory cards, flash disk drives, HDDs, SSDs, pen drives, and any other storage media, without the usage of the software on your PC.

The following question that puts everything in perspective is:

How do you recover files using the CMD? Also, can you utilize the Command Prompt to restore all lost data? People are asking the same question about Command Prompt data recovery.

To answer that accurately, we'll see if there is a command-line option available for executing the recovery.

Command prompt is a strong and useful Windows built-in program that allows you to take complete control of your computer and do data recovery tasks after any type of data loss, including unintentional deletion, virus attack, inadvertent storage formatting, and many more scenarios.

2 Ways for using Command Prompt recover deleted files

In this part, we’ll show you 2 kinds of commands to recover deleted files.

Line 1. attrib command to recover deleted, lost, hidden files

The attrib command in Windows is used to display, change, or remove file and folder attributes. Attributes define specific properties of a file or folder, such as whether it is hidden, read-only, or marked as a system file. This command is helpful for managing file visibility and protecting critical files from accidental modifications or deletions on devices like Windows drive, external HDD, USB, SD card, and any other external storage media.

Step 1. Head over to the start menu, and key in "cmd" in the search bar, and hit the Enter key. This will open a pane on the left, showing the command prompt app.

Step 2. Right-click on the Command Prompt app and select "open as admin" to open the windows of cmd.

Step3. On the CMD command line, key in the following command:

attrib -h -r -s /s /d drive letter:\*.*"

For instance, attrib -h -r -s /s /d H:\*.*" if the drive you wish to recover is H. Replace H with the external drive letter of your external storage media.

Line 2. Try CHKDSK

To recover deleted files using the CMD, you can use "chkdsk [drive letter]: /f /r /x"; this will scan the specified drive for errors and attempt to recover deleted files, but the effectiveness depends on the file system and how thoroughly the files were deleted.

Step 1. Open the Command Prompt as administrator.

Step 2. Type "chkdsk g: /f /r /x " and press Enter.

Step 3. If prompted, press "Y" to confirm the disk check.

Easily recover files using the CMD alternative

Although CMD is a great built-in tool, it cannot adequately address more complicated data loss situations. CMD might not be enough in circumstances including empty Recycle Bin, formatted drives, lost partitions, and system failures. Furthermore, it's best not to use CMD unless you are sure your commands are accurate. A mistyped command could either aggravate already present problems or start fresh ones.

So, to make sure to recover lost files, a specific data recovery program is required. We propose using user-friendly solutions such as AOMEI FastRecovery. It can:

πŸ’ͺ🏼 Recover files from permanently erased, corrupted, formatted, and more data loss situations. 🌈 Restore Word, Excel, PowerPoint images, videos, audio, emails, and almost 2000 file formats. πŸ’» Get erased files from USB flash drives, SD cards, HDDs, SSDs, and other 1000+ storage media.

Free DownloadWindows PCs and Servers
Secure Download

Step 1. Install and launch AOMEI FastRecovery. Choose the exact partition or disk where your data lost and click Scan.

Step 2. Then, the recovery tool start to scan and search. lt will execute the “Quickly Scan" first to find your deleted data fast, and then execute the “Deep Scan" for searching other lost data.

Step 3. Once the scan is completed, all deleted files, recycle bins and other missing files will be displayed. Please select the file you would like to recover and then click "Recover".

Step 4. Then, select a folder path to save your recovered files.

Step 5. Wait patiently for this process of recovering ends.

Bonus tips: How to prevent data loss on Windows PC

1. Regular Backups

  • Use Backup Tools: Use Windows built-in backup tools like File History or Backup and Restore (Windows 7).
  • Cloud Storage: Store important files in cloud services like OneDrive, Google Drive, or Dropbox.
  • External Drives: Regularly back up data to an external hard drive or SSD.

2. Enable System Restore

Turn on System Restore to create restore points that allow you to revert your system to a previous state if problems occur.

3. Monitor Disk Health

Use tools like CHKDSK or the built-in Disk Health feature to monitor the status of your hard drive or SSD.

4. Avoid Suspicious Files and Websites

Do not download attachments or open links from untrusted sources. Be cautious when downloading software, ensuring it's from official or trusted websites.

Ending lines

The primary focus of this article is the process of recovering files from an external hard drive using the Command Prompt. The command lines "attrib" and "chkdsk" are thoroughly explained.

CMD's capabilities are restricted, despite its potential efficacy in specific data recovery scenarios. It is strongly advised to employ a specialized data recovery application, such as AOMEI FastRecovery, for more intricate data loss scenarios, particularly those that involve logical issues. In addition to the PC edition, this utility is also compatible with Windows Server operating systems for Windows Server users.

Free DownloadWindows PCs and Servers
Secure Download