2 Options to Recover Deleted Files Using Command Prompt

menu_default hide_default

Deleting files to create space for others is a normal thing for most people. There are instances where the deleted files suddenly become important and people go into frantic effort to get them back. In some other instances, files are mistakenly deleted permanently from a device, putting the individual in a very critical condition. If you are looking for how to recover deleted files using CMD (command prompt), this is the right place to be.

Part 1: 3 Options to Recover Deleted Files with CMD

The command prompt is one of the most powerful inbuilt utility tools in a computer. It can be used to troubleshoot and fix most issues relating to Windows. Additionally, a correct command line can help you recover deleted files from local hard disks and external storage devices without the help of third-party software.

Let's check how it makes things possible.

Option 1: Recover Deleted Files from External Hard Drive using CMD

There are times you may unintentionally delete a file from the external hard drive or flash drive, then you can follow these steps to retrieve them from Windows 10/8/7.

Step 1: Press Windows + R key simultaneously and type in CMD.

Step 2: In the pop-up window, type chkdsk ‘drive letter’ /f and press Enter.

Step 3: Press Y (yes) until the command line starts again.

Step 4: Type the drive letter again and press Enter.

Step 5: Type [drive letter : \ >attrib –h –r –s /s /d *.*]. Then all the lost and deleted files in the external storage device will be retrieved.

Note:

It requires you to create a new folder for the recovered files after completing the above steps. Since all the files will be available in .chk format, you have to change the file extension by yourself and save each file at the preferred location.

Option 2: Recover Deleted Files from Recycle Bin with Command Prompt

If the option 1 doesn't work for you, try this method. Please note that this method only works when the deleted files have been moved into Recycle Bin and kept there. If you use the command line or press shift+delete to delete one file, the deleted file won't show up in the Recycle Bin folder. Furthermore, this method won't work if you accidentally emptied Recycle Bin after the deletion.

Now, follow the steps below to recover deleted files from Recycle Bin with CMD.

Step 1: Type command prompt in the search bar.

Step 2: Right-click on command prompt utility and run it as administrator.

cmd run administrator

Step 3: Type the following command in the CMD window: start shell:RecycleBinFolder and press Enter.

Step 4: The Recycle Bin folder will pop up. Locate the file you want to recover and restore it to the original location on your computer.

Option 3: Recover Deleted Files from Virus Infected Hard Disk Using Attrib Command

Nowadays, we spend a lot of time surfing the Internet every day. And some of us will download some free or cracked programs from unofficial websites. These will increase the risk of infecting viruses. Once your computer has been infected by a virus, some files will be deleted. And if you connect any external storage devices to your computer, the files on your external devices will also be deleted. Actually, those files have not been permanently deleted, they just have been hidden by virus.

Luckily, there is a way to unhide or recover those deleted files with CMD. Here's how:

Step 1: Run command prompt as administrator.

Step 2: Type the command ATTRIB -H -R -S /S /D X:*.* and press Enter. Please remember to replace X with your own drive letter.

command-prompt

Once the command has been executed, the deleted files will appear on your hard drive automatically.

Note:

There could be a circumstance where you will see an "access denied" error under each directory. If that's your situation, the following are some tips for you.

  • Be sure you run CMD as administrator.

  • Check if the file is in use. If the file is opened by another program, you'll see an "access denied" error.

  • Make sure you have full control of the file. You can check it from file properties.

  • This error will occur if there is a problem with the hard drive. You can use the command CHKDSK X: /f to check if there is an error on your hard drive.

Part 2: What If the Deleted Files Cannot Be Recovered by Using CMD

Command prompt does not work in some instances, where your computer crashed, you emptied the Recycle Bin, or you formatted the hard drive. Moreover, a little mistake on the command line will cause damage to your operating system and existing data. Thus, you need a method or tool that can recover deleted or lost files in all cases.

AnyRecover is an effective tool to use. Following are some impressive features of it.

product

1,000,000 + Downloads

AnyRecover Can Easily Help You Recover Your Western Digital Data
  • Work in every data loss scenario. It can recover data from emptied Recycle Bin, RAW hard disk, crashed computer, and so on.

  • The software works great for 1000+ file types including images, videos, documents, audio files, emails, archives, etc.

  • Recover data from different types of storage devices including internal hard disk, external hard drive, phone memory, camera memory, USB drive, memory card, and more.

  • It's totally free to scan and preview data, and you can recover 3 files for free.

Before you decide to use the program to recover deleted files, you can download the program to check whether it can find your lost or deleted files first.

Download NowDownload Now

You can follow this video guide to recover deleted files.

Tip: How to Recover Lost Files from Corrupted Hard Disk with CMD

There are several reasons that will cause a corrupted hard disk, for example, improper operations and external damage. CMD is an advanced tool that can check and fix the errors on your hard disk, then recover the lost data from it.

How can you do that? Check here:

Step 1: Run command prompt as administrator.

Step 2: In the command prompt windows, type CHKDSK X: /f and press Enter. Please replace X with your real drive letter. If you are not sure what the drive letter is, you can find it in File Explorer.

Step 3: Once the code has been carried out, it will begin to check the disk. It contains 5 stages, so it will take some time.

Step 4: You need to enter another command line after the checking process. It is ATTRIB -H -R -S /S /D X:*.*

Step 5: Press Enter and wait for the process to complete. Then, you'll find the lost files display on the hard disk again.

recover deleted files with cmd

Conclusion

The 3 options mentioned in this post are applicable to different scenario. You can recover the deleted files from external hard disk or from recycle bin using CMD. But sometimes the manual ways have some constrains. So we've recommended a practical tool which is effective in retrieving deleted files on PC without any risk.

user

By  Simon Marcus , to Deleted Files Recovery

Updated on Jan 15, 2021

Related Articles: