How to Recover Deleted Files from Flash Drive Using CMD

mia-j
By  
recover-deleted-files-from-flash-drive-using-cmd

Picture this: you open your flash drive, ready to grab that important document or photo, and it’s just… not there. Maybe you accidentally deleted it, or maybe it disappeared after some system issue. Either way, it’s frustrating. But here’s the good news — you don’t need to rush out and buy expensive recovery software. Windows actually has built-in tools that can help you bring those files back, and you can do it using simple command-line steps. In this guide, you’ll learn how to recover deleted files from flash drive using CMD. Whether your files were hidden by mistake or permanently deleted, these methods can help you get them back. And if the command line feels too technical, no worries — I’ll also share an easier, free tool that can do the job with just a few clicks. Let’s get started and see what’s possible!

Command Introduction

Windows offers several command-line options to help recover or unhide files without installing extra software:

  • attrib command — This built-in command changes file attributes. It’s useful when files are accidentally hidden or marked as system files rather than truly deleted.
  • Windows File Recovery (winfr) — A free official tool from Microsoft that can deeply scan drives to recover permanently deleted files. It supports various recovery modes for different data loss scenarios.
attrib command syntax

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

This command removes hidden, read-only, and system attributes from all files and folders on the drive (replace X: with your actual USB drive letter).

winfr command syntax

winfr source-drive: destination-folder [/mode] [/n filename] [/y:filetype]

This command scans the source drive for deleted files and restores them to the destination folder using the selected recovery mode.

Parameter Explanation
ParameterDescription
-hRemoves the hidden attribute from files and folders
-rRemoves the read-only attribute
-sRemoves the system file attribute
/sApplies to files in subdirectories
/dIncludes directories
/regularWinfr mode for recently deleted files
/segmentWinfr mode for structured file recovery
/signatureWinfr mode for file type-based recovery
/nFilter by filename or pattern
/yFilter by file type (e.g., ZIP, JPG)

Usage Examples (With Explanations)

Example 1: Unhide Files on a Flash Drive Using attrib

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

This command removes hidden, read-only, and system attributes from all files and folders on USB drive E:. It’s useful if your files are still there but have been hidden by accident or malware. After running this, open File Explorer — you should see the files reappear.

Example 2: Recover Recently Deleted Photos Using winfr Regular Mode

winfr E: D:\Recovered /regular /n *.jpg

This uses Winfr’s regular mode to recover recently deleted .jpg images from USB drive E: and save them in the folder D:\Recovered. Regular mode works well if the files were deleted not long ago and the drive hasn’t been heavily used since.

Example 3: Restore Deleted Word Documents with winfr Segment Mode

winfr E: D:\Recovered /segment /n *.docx

This command tells Winfr to scan the file system’s metadata (segment mode) to recover .docx Word files from drive E:. Use this if regular mode didn’t find what you need, as segment mode digs deeper by analyzing file records.

Example 4: Recover ZIP Archives with winfr Signature Mode

winfr E: D:\Recovered /signature /y:ZIP

This runs Winfr’s signature mode to recover deleted ZIP files by searching for file headers directly on the drive. Signature mode is great if the file system is corrupted or you’ve formatted the drive and need to scan for specific file types.

Example 5: Recover All File Types Using winfr Regular Mode

winfr E: D:\Recovered /regular /n *.*

This command attempts to recover all recently deleted files, regardless of type, from USB drive E: to D:\Recovered. It’s helpful if you’re unsure about the file extension or want to recover everything that’s possible.

What to Do If Commands Fail: Try WinfrGUI

If attrib or winfr don’t recover your files — or if using the command line feels too complicated — you can switch to WinfrGUI, a free and easy alternative.

  • 100% free to use, with no ads or hidden restrictions
  • Built on Microsoft’s official recovery engine (the same technology behind winfr)
  • Simple, step-by-step interface — no need to type commands
  • Supports recovery of documents, photos, videos, archives, and more

WinfrGUI lets you scan your flash drive and recover lost files with just a few clicks, making it a great choice if you want a faster, easier solution.

Related CMD Command: Using chkdsk to Fix USB Drive Errors

Before running recovery tools, sometimes corrupted USB drives cause files to disappear. You can try this command to check and fix file system errors on your flash drive:

chkdsk E: /f /r /x

  • Replace E: with your USB drive letter
  • /f fixes errors on the disk
  • /r locates bad sectors and recovers readable information
  • /x forces the drive to dismount before the process starts

Running chkdsk can repair issues that prevent file access, improving your chances of successful recovery with commands or WinfrGUI.

Common Questions and Notes

Q1. Why do recovered files sometimes not open or appear corrupted?

The data may have been partially overwritten. Try using a different Winfr mode or recover as soon as possible to increase success.

Q2. What if Winfr says “source drive not found”?

Double-check the USB drive letter. Ensure it’s connected properly and try again.

Q3. Why are files missing after using attrib?

They may have been permanently deleted rather than hidden. You’ll need to use Winfr or another recovery tool.

Q4. How much space do I need on the destination drive for Winfr?

Ensure the destination drive (e.g., D:) has at least twice the space of the files you expect to recover to avoid errors.

Q5. The commands seem too complicated. What’s an easier way?

Consider using WinfrGUI, a free graphical tool that makes recovery much simpler without needing to type commands.

Conclusion

So there you have it — losing files on a flash drive isn’t the end of the world. As you’ve seen, you can often recover deleted files from flash drive using CMD without spending a cent on recovery software. The attrib and winfr commands might look a little scary at first, but with a bit of patience, they can really work wonders. That said, I totally get it — the command line isn’t for everyone, and sometimes recovery doesn’t go as planned. If that happens, don’t stress. Tools like WinfrGUI make the whole process way easier — no typing, just a few clicks. The most important thing? Act fast so your deleted files don’t get overwritten. And if you haven’t already, now’s a great time to set up regular backups. Your future self will thank you!

🔗 Also Read: