How to recover deleted files using the Command prompt on a Windows PC

Posted in:

Losing your data out of the blue is seldom comfortable. The usual reaction is that of panic or of confusion, and it makes sense. Luckily, you don’t have to worry long if you are a Windows user. Whether it’s an accidental data loss or your computer files, have become corrupted by malware, recovering them isn’t the dallying task it used to be.

There are tools, both in-built and professional, that can recover your files as quickly as you can delete them. The Windows Command prompt is one such application. With a couple of commands, you can quickly recover your command prompt files. Let’s look at both of them one by one.

How to recover deleted files using the Command prompt

The Command prompt, also known as cmd for short, is a handy utility that lets you do all sorts of stuff straight from your keyboard. In this case, we will also use it to recover your deleted Windows files.

Now, depending on what has happened with your computer files and where they are, you will have to rely on different methods. For instance, if your files are in the recycle bin, you will have to use a very different set of commands, than when they are somewhere else.

Here’s how you can recover your deleted files using the Command prompt:

  • Head to the Start menu search bar, type in ‘cmd,’ and run the cmd as administrator.
  • Now head to the Command prompt, type in the following command, and hit Enter:
    start shell:RecycleBinFolder
  • The Recycle Bin will be launched.

command prompt

From there, you can select and restore the files you want to recover. This method will be convenient when you cannot access your recycle bin from the desktop itself.

Recover deleted files from external drives using CMD

Whether it’s an external hard disk, a UBS stick, or even some SD card, you can quickly recover your deleted files with the help of a Command prompt. Again, as we said above, the command will be different. 

Here’s how you can get started with it:

  1. Connect the external drive to your computer.
  2. Launch the Command prompt as an administrator.
  3. Type in the following commands on your Command prompt and hit Enter:
    attrib -h -r -s /s /d drive letter:\*.*"

For instance, use attrib -h -r -s /s /d D:\*.*” if the drive you wish to recover is D. But if it’s something else, you can replace the D with the external drive letter of your external storage media.

Your deleted files will be restored immediately if you have followed the above steps as they are. There are, of course, other ways to go about Windows file recovery that don’t rely on the Command prompt, but if you are looking to stick with the Command prompt strictly, then these methods are the only ways.

Recovering deleted files using the Command prompt

The Command prompt has a remedy for almost everything. Be it encrypting your Windows files, copying your files or folders, or even deleting them, with the Command prompt, you can manage it all. Hopefully, the methods we laid out above helped recover your deleted files.

< Previous

Microsoft promises to bring badges to Edge Add-ons Store for quality-control

How to delete user profiles on a Windows PC

Next >