How to Recover Deleted Files Using CMD (3 Ways)

This article describes 3 effective methods to recover deleted files using CMD and applies to computers, external disks, USB drives, etc. Computer novices can try the alternative method.

Ivy

By Ivy / Updated on December 26, 2024

Share this: instagram reddit

Is it possible to recover deleted files using Command Prompt?

🌟Yes, it is possible to recover deleted files using Command Prompt, whether it's on a computer or external disks, USB flash drives, SD cards, mobile devices, etc.

CMD, also known as Command Prompt, is available on most Windows operating systems. It is a free and powerful tool that can perform any operation with administrator priority and troubleshoot different types of Windows issues, such as recover deleted files, repair bad sectors, and even convert RAW file system to NTFS, etc.

Here we will show you how to recover files using CMD. If you are new to computers, it will be a better choice to try the powerful data recovery software - MyRecover in Part 3, with a graphical user interface, which is easy to use and efficient.

How to recover deleted files using CMD

Now, I am going to share with you how to recover deleted files using CMD in 3 easy and efficient methods. It applies to computer, external drives, USB sticks, SD cards, etc.

1. Restore deleted files from Recycle Bin using CMD

The first is to recover deleted files from the Recycle Bin using Command Prompt. If you accidentally deleted files using the Delete key, try this method and see if it works.

Step 1. Press Windows+R to open the Run window.  Type CMD and press Enter to open the Command Prompt.

Step 2. In the Command Prompt window, type start shell:RecycleBinFolder and hit Enter.

type cmd recycle bin

Step 3.  In the Recycle Bin, right-click the files you want to recover and click Restore.

2. Recover permanently deleted files using Command Prompt 

As we all know, if you connect the external hard drive or or USB drive to your computer, when you delete files from it, the deleted files will not go to the Recycle Bin. At this time, you can use the chkdsk and Attrib commands to get your data back.

⚠️This command applies to deleted, lost, hidden, and even virus-infected file recovery. 

Step 1. Press Windows + R to open the Run window.  Type cmd in the dialogue box and hit Enter.

Step 2. In the Command Prompt window, type chkdsk G: /f and press Enter

Step 3. If any files are being used, close it or type Y to force it to be uninstalled.

Step 4. Type in G: and press Enter again. The command line will go back to the start.

Step 5. Now, type G: \>attrib -h -r -s /s /d *.* and press Enter. 

attrib cmd

⚠️Notes:
  • The -h assigns the Hidden attribute to the selected files. 

  • The -r refers to the Read-only attribute. It means the files are readable but non-modifiable.

  • The -s assigns the "System" attribute to the selected files.

  • The /s implies searching a specified path including subfolders.

  • The /d includes the process folders.

You can replace "G:" with your drive letter and wait patiently. 

After completing the recovery process, you'll see a new folder containing all the recovered files in .chk format. You can also change the file extensions to a preferred extension for each file.

3. Retrieve deleted files using CMD via Windows File Recovery

Windows File Recovery is Microsoft's official data recovery tool, a command-line application that can be used to recover files that have been deleted from your computer, external disks, USB drives, and more. It currently works on Windows 10 2004 and above. 

Before recovering deleted files using Command Prompt, you need to learn the general command line and parameters. 

  • The syntax: winfr source-drive:destination-drive:[/mode] [/switches]

  • The source drive and destination drive can't be the same. 

  • winfr has two basic modes: Regular & Extensive. Note the Extensive mode includes two advanced modes: Segment & Signature. 

  • You need to check the file system of your drive and data loss scenarios as it determines which mode you use.

  • The switches help to target the filter range or narrow it. 

You can type winfr.exe /? to learn more. Or click how to use Windows File Recovery

Step 1. Go to the Microsoft Store, search, and get Windows File Recovery.

microsoft store get

Step 2. Open Windows File Recovery to start data recovery. For example, recover deleted Docx files from E: drive to D: drive in Segment mode, type as: winfr E: D: /segment /n *.docx.

winfr segment docx

Step 3. After that, a recovery folder will be created in the destination drive of your choice. You can go to check if the lost data is recovered.

Try CMD alternative to recover deleted files

⚠️As you can see, the CMD has many complex parameters and lacks a graphical user interface (GUI), so it is a bit technical and complicated for most users. You need to be careful when entering the corresponding commands, and even then, errors can occur, causing irreversible damage.

Thus, it will be a better choice to try the CMD alternative if you are green hands. MyRecover is a user-friendly and powerful data recovery software that can help you recover deleted files from computers, external disks, USB drives, SD cards, digital cameras, etc.

MyRecover
Why Choose MyRecover?
  • Combine Quick Scan and Deep Scan technologies to detect deleted or lost files.
  • Recover deleted files in more than 1000+ formats, including photos, videos, images, documents (e.g. recover deleted Word documents), audios, etc.
  • Search or filter data quickly through file name, extension, data type, etc. 
  • Preview and recover files while scanning.
  • Recover specific files or folders instead of all.
  • Work perfectly with NTFS, FAT32, exFAT, ReFS and Windows 11/10/8/7 and Windows Server.
  • Recover data in any scenario, such as accidental deletion, disk formatting, system crash, lost partition, virus attack.

Now, free download and install this data recovery software to get back your files in just a few clicks.

Download SoftwareWin 11/10/8/7/Server
Secure Download

Step 1. Open MyRecover on your computer. Hover the mouse over the drive saved deleted files before, and click Scan to scan.

select-location-to-scan

Step 2. It will automatically check the drive for all deleted or lost files. You can find them in the Deleted Files, Recycle Bin, or Other Missing Files folder as MyRecover saves them here. Or you can search or filter them using the following items:

  • Type: Specify the data type (Documents, Images, Videos, Audio, Mails, Webpages, Compressed files, etc.)
  • Date modified: Set the date (today, yesterday, last 7/30 days, etc.)
  • Size: Filter the file size (<128KB, 128KB~1MB, 1MB~ 512MB, 512MB above, etc.)
  • Name/Extension: Type the file name or its extension to narrow the filter.

scanning-drive

Step 3. Once found, double-click the files to preview and select the needed files. Then, click the Recover x files button and select a new location to save them. You don't need to wait for the full scanning process.

Filter PDF

Conclusion

To sum up, this post shows you 3 effective methods on how to recover deleted files using CMD that you can try to recover your files. However, it is not easy for everyone to use Command Prompt or command-line tools. Therefore, you can try powerful data recovery software - MyRecover, with a graphical user interface, to recover files with one click.

Download SoftwareWin 11/10/8/7/Server
Secure Download

By the way, regular backups are the best way to avoid data loss. To keep your data safe, you can try to use backup software - AOMEI Backupper Standard to make a regular backup of files, partitions, even the entire disks, and restore data when needed.

Ivy
Ivy · Editor
Lora is an editor of AOMEI Technology. She is also a tester and editor of AOMEI Data Recovery Tools. -- "Keep testing, write the most useful tutorials for helping people recover the lost data for Windows and phones" is the most meaningful thing for her. Dedicated to creating helpful tutorials, she hopes her tutorial can assist users to effortlessly solve data loss problems on their personal computers and mobile phones.