How to Recover Deleted Files Using Command Prompt?

Written byMariaUpdated on Jun 28, 2023
Gerhard Chou
Approved byGerhard Chou

Table of Contents

Summary: We will introduce a free data recovery method: recover deleted files with Command Prompt. Follow the Command Prompt recovery steps, you can recover deleted files from SD card, USB flash drive, etc. You also can try data recovery software to recover lost data in an more easier way.

A command prompt is a potent tool when retrieving deleted files from an external drive, USB flash drive, SD card, HDD, SSD. Prompt carries out several distinct commands to complete the recovery process. Here, then, are some instructions that can be used to retrieve deleted data:

The attrib command must be used before attempting to restore erased files. Verify that you have entered the correct command. Because if you take the wrong action, it could have disastrous consequences. The scripting language is also used for the CMD commands. Therefore, you must carry out the instruction verbatim.

What is a PC's Command Prompt?

The Command Prompt (also called CMD or Command Line) on a Windows PC is a potent tool that can grant you unprecedented access to the operating system. When you get the hang of it, the possibilities outweigh its scary aspect. It provides a command-line interface for interacting with your computer, allowing you greater access to the inner workings of your system.

You can do everything from renaming and copying files to executing scripts, system diagnostics, and undelete. Automating operations, fixing problems, and unlocking capabilities that aren't visible in the GUI are all possible with the right commands. If you're not tech-savvy but still want more power over your computer, you should check out the Command Prompt.

Why can deleted files be recovered using the Command Prompt?

Many Windows-related issues, such as hard disk recovery, can be addressed using Command Prompt. It's the most potent data recovery tool that comes standard with Windows.

In addition, you can use this Windows tool to create bad sectors on storage media and switch from the RAW to the NTFS file system. You may use cmd to get your info back if you accidentally lose it.

But before we go any further, let's investigate the file system to learn how cmd accesses information.

There are two components to a file:

  • A folder that contains both the file's name and its associated block number.
  • The informational building blocks themselves.

Even when you delete a file, the data is still in the underlying block if it hasn't been overwritten or updated. As a result, the directory items are identified as available yet concealed from the operating system. In such a scenario, the command prompt can swiftly restore the lost information.

recover deleted files with Command Prompt

How to recover deleted data in recycle bin using the Command prompt?

The cmd or Command prompt is a useful tool that provides quick access to various functions. In this case, we'll also use it to return any Windows data you accidentally erased.

Depending on the state of your computer files and where you last saw them, you may have to resort to one of several strategies. You'll need a completely new set of commands if, for example, your files are in the trash can rather than some other location.

Here's how to use the CMD to get back your lost data:

Step 1. Put "cmd" into the Start menu's search field to launch a command prompt with administrative privileges.

Step 2. Next, at the Prompt, enter the command:

Start shell:RecycleBinFolder

Step 3. Launching the Recycle Bin.

Step 4. You can then pick and choose which files to restore. That is a handy alternative when you can't get to the trash can on your desktop.

Recover permanently deleted files from USB drive/SD card/external drive with CMD

We are all aware that when a file is deleted from a connected external device, such as a flash drive or USB drive, the file is not moved to the trash can on the host computer. For that purpose, we employ the Attrib command. It can be used to retrieve data from any USB or flash disk. Recover Deleted Files Using CMD or the Built-in Drive Using Command Prompt Using These Easy Steps:

Step 1. Open a command prompt by clicking the Windows start button and typing "cmd" into the box that appears. Just hit Enter to exit it.

Step 2. Then, press the Enter key after typing "chkdsk F:/f" (where "F" is the letter of your drive). If the volume's file is open, you can close it or press Y to remove it.

Step 3. Press F, then Enter again.

Step 4. Type in F: \>attrib -h -r -s /s /d *.* and press Enter. Using this command, you can retrieve data from your deleted drive.

Remember that each "F" above stands for the drive letter of the USB device from which you seek to retrieve deleted files. When you finish step 5, a new folder containing your recovered files will be on your external disk or device. You can make the files usable again by simply reverting to their original filenames and extensions.

Recover lost data from any hard drive or device with Command Prompt alternative

If you not an IT Pro and want to recover lost files with simple method, you can try data recovery software. Donemax Data Recovery is best Command Prompt alternative, it has many advantages, such as:

  • Complete DIY tool: three steps to recover deleted files or lost files.
  • Recover lost data from PC, Mac, USB drive, external disk, HDD, SSD, SD card, digital camera, RAID, etc.
  • Recover permanently deleted files, formatted data or inaccessible data.
  • Recover deleted or lost hard drive partition.

With this Command Prompt alternative, you can easily and quickly recover any deleted files from any hard drive or external storage device. Just check the steps below:

Step 1. Download and install Donemax Data Recovery.

Click the download button below to download Donemax Data Recovery and install it on your computer.

Step 2. Select the hard drive.

Open Donemax Data Recovery, select the hard drive where you delete or lose your files. If the drive is an external device, make sure it is connected to your computer.

recover deleted files with Command Prompt

Step 3. Scan the hard drive.

Click on Scan button. Then this Command Prompt recovery software will deeply scan the hard drive and find all recoverable files.

recover deleted files with Command Prompt

Step 4. Preview and recover lost files.

Once the scan is completed, you can preview all recoverable files. Select the wanted files and then save them to a safe location.

recover deleted files with Command Prompt


The Command Prompt is a very useful feature of Windows that cannot be ignored. It's a reliable tool for handling hard drive and flash drive administration tasks like partition formatting and deletion. Files lost on a USB drive, SD card, or hard drive can be restored with CMD. This article explains how to use the Command Prompt to retrieve lost data. If you think it is difficult for you, you can download a DIY data recovery tool to help you recover deleted/lost files.

Contributing Writer


Maria is one of the senior writers & editors of Donemax who lives and works in Sydney, Australia. She loves PC, Mac and Internet Technology. She has 6 years of writing articles about data recovery on PC/Mac, disk cloning solution, data eraser and computer OS optimization, etc. She is also interested in testing various software and digital products.

Gerhard Chou
Editor in chief

Gerhard Chou

In order to effectively solve the problems for our customers, every article and troubleshooting solution published on our website has been strictly tested and practiced. Our editors love researching and using computers and testing software, and are willing to help computer users with their problems