3 Ways to Recover Deleted Files Using Command Prompt

mia-j
By  
recover-deleted-files-using-command-prompt

When using a computer, most of us have encountered command prompts, but few really understand what they mean or how to use them effectively. Simply put, a command prompt is a text-based interface in an operating system where users can input commands directly. Unlike the graphical user interface (GUI) that relies on visual elements, command prompts require users to memorize and type specific commands, which can feel complex for many. However, command prompts are powerful and versatile, and one of their common uses is for data recovery. In this article, I will introduce you to three effective ways recover permanently deleted files using command prompt. By reading this post, you’ll gain a better understanding of command prompts and how to leverage them for file recovery.

Method 1: Recover Deleted Files Using the attrib Command

If you want to recover deleted files without installing any third-party software, the built-in Windows attrib command can help. This command is especially useful for restoring files that have been hidden or made inaccessible due to virus attacks or incorrect system settings. It works well on USB drives, external hard drives, SD cards, and other storage devices. However, keep in mind that the attrib command cannot recover files that have been permanently deleted or overwritten—it mainly restores hidden or system files. Steps to use the attrib command to recover files:

Step 1: Type CMD in the Windows search bar and run it as Administrator.

Step 2: Enter the following command and press Enter:

attrib -h -r -s /s /d X:\*.*

Replace X: with the drive letter where you want to recover files (e.g., E: for your USB drive).

  • -h removes the hidden attribute.
  • -r removes the read-only attribute.
  • -s removes the system file attribute.
  • /s applies the command to all files in all subdirectories.
  • /d includes any directories.

Step 3: Wait for the process to complete and check your drive for recovered files

After inputting the attrib command line, wait for a while, you will find the restored file on your destination drive. By the way, its application is not extensive so you can try the next two methods.

Method 2: Recover Deleted Files Using Windows File Recovery (Command Line Tool)

Microsoft introduced Windows File Recovery in 2020 as a command-line utility designed specifically for recovering deleted files on Windows 10 and later versions. It supports different file systems and recovery scenarios but requires understanding and correctly writing command-line scripts.

How to Use Windows File Recovery

Step 1: Download and install Windows File Recovery from the Microsoft Store.

recover deleted files

Step 2: Familiarize yourself with the command structure:

winfr source-drive: destination-drive: [/mode] [/switches]

  • Source drive: The drive where files were deleted.
  • Destination drive: The drive where recovered files will be saved.
  • Mode: Choose between Regular or Extensive depending on the situation.
  • Switches: Additional filters to narrow the scan scope.

Step 3: Compose the appropriate command with the above parameters and execute it in the command prompt.

Choosing the Right Mode Based on File System and Scenario
File SystemScenarioMode
NTFSRecently deleted filesRegular
NTFSOlder deletionsExtensive
NTFSFormatted diskExtensive
NTFSCorrupted diskExtensive
FAT/exFATAny scenarioExtensive
Common Switches and Their Meanings
SwitchMeaningSupported Modes
/nFilters scan by file name, path, or typeAll
/yRecovers system filesNTFS Regular/Extensive
/segmentRecovers fragmented filesNTFS Extensive
/uRecovers undeleted files (e.g., from Recycle Bin)NTFS Extensive

After running the command, Windows File Recovery will scan the source drive and save recoverable files to the destination.

Method 3: Recover Files with WinfrGUI

In fact, it is more complicated to recover deleted files using command prompt, because many people do not understand the professional vocabulary of computers, which leads to many problems in the process of recovering files. There is a more convenient freeware you can try. WinfrGUI is a user-friendly software that can recover files without entering complicated command lines, with just a few mouse clicks according to the graphical interface given. I believe you must be very interested, and WinfrGUI also fully invokes the functionality of Windows File Recovery, which is exactly the same as its use effect. Now, I will show you how to use it. At first, you can install this freeware.

Step 1: Select the range to scan, and then choose a place to restore files.

recover  files

Step 2: Choose the scan mode, and determine the file type in “Advanced settings”.

recovery

Step 3: Click the “Start Recovery” to complete the process.

command prompt

As you can see, it is a more efficient software for recovering files, and at the same time, its safety factor is also very high.

Troubleshooting FAQ

Q1: The attrib command didn’t recover my deleted files. What should I do?

The attrib command only restores hidden or system files and does not recover permanently deleted files. Try using Windows File Recovery or WinfrGUI for a more thorough recovery.

Q2: Windows File Recovery commands are too complicated. Any tips?

Take time to study the official documentation and the command parameters. Alternatively, use WinfrGUI, which simplifies the process with a graphical interface.

Q3: Can I recover files from formatted or corrupted drives?

Yes, but you need to use the Extensive mode in Windows File Recovery or use WinfrGUI, which supports these scenarios.

Q4: Is it safe to recover files using these tools?

Yes, these are official or reputable tools that only read data without modifying your original files. Still, avoid saving recovered files to the source drive to prevent overwriting.

Final Thoughts

Recovering deleted files using the command prompt is a powerful method but not always user-friendly, especially for those unfamiliar with technical commands. The attrib command can help restore hidden files quickly but has limited recovery capabilities. Microsoft’s Windows File Recovery tool offers comprehensive recovery for various scenarios but requires command-line knowledge. For most users, WinfrGUI provides a perfect balance—offering full recovery power through a simple graphical interface, making the process easy and efficient without technical hurdles. Depending on your comfort level and recovery needs, you can choose the method that works best for you. Remember, acting quickly and avoiding saving new data to the affected drive improves the chances of successful recovery.

🔗 Also Read: How to Recover Deleted Files from SD Card Using CMD