Windows File Recovery and free open source tools to get deleted files back
By Pull This RepoPosted 5 min read
Short answer
Windows File Recovery is Microsoft's free command line tool for deleted files that are no longer in the Recycle Bin. Install it from the Microsoft Store, then run winfr with the source drive, a different destination drive and a mode, for example winfr C: E: /regular /n *.docx. For damaged or formatted drives, the open source PhotoRec and TestDisk are free alternatives.
Windows File Recovery is a free Microsoft app that gets back files deleted from a local drive after they have left the Recycle Bin. It has no window: you type a winfr command that names the drive to search, a different drive to save to, and a mode. This page shows the exact commands, which mode to pick, and two free open source tools, PhotoRec and TestDisk, for when Microsoft's tool is not enough. Every command was checked against Microsoft's support page and the CGSecurity documentation on 22 November 2026.
This is about getting back deleted files, not about the Windows Recovery Environment that repairs a PC that will not start.
What should you do first after deleting a file?
Stop using that drive, then check the two easy places before any recovery tool. Microsoft's own advice is to minimise or avoid using your computer, because a deleted file can only be recovered until new data reuses its space.
- Recycle Bin. Open it, find the file, right-click it and choose Restore.
- File History. If you turned it on earlier, open File Explorer, go to the folder that held the file, right-click the folder and choose Restore previous versions. Pick a version from before the loss and select Restore, or expand the button and choose Restore to to save it somewhere else. Microsoft notes that restoring over the current copy cannot be undone.
- Cloud copies. If the folder was synced with a cloud drive, check that service's own deleted files area.
If none of these has the file, move on to Windows File Recovery.
How do you use Windows File Recovery?
Install Windows File Recovery from the Microsoft Store, search for it from the Start menu, and accept the prompt to allow it to make changes. A command window opens. The syntax from Microsoft is:
winfr source-drive: destination-drive: [/mode] [/switches]The source and destination must be different drives. Use a USB stick or external drive as the destination, and keep it big enough for what you are getting back. Windows makes a folder named Recovery_<date and time> on the destination and puts the files there.
Examples from Microsoft's page, with <username> replaced by your account name:
winfr C: E: /regular /n \Users\<username>\Documents\
winfr C: E: /regular /n *.pdf /n *.docx
winfr E: C: /extensive /n *invoice*
winfr C: E: /regular /n "\Users\<username>\Documents\Quarterly Statement.docx"Syntax tips from the same page: include the colon after each drive letter, end folder paths with a backslash, and put quotes around names with spaces. To find your username, open C:\Users in File Explorer. Enter Y at the prompt to start, and press Ctrl + C to stop.
Which winfr mode should you use?
Start with Regular on a healthy NTFS drive and move to Extensive if it finds nothing. This is Microsoft's table:
| File system | Situation | Mode |
|---|---|---|
| NTFS | deleted recently | Regular (/regular) |
| NTFS | deleted a while ago | Extensive (/extensive) |
| NTFS | drive was formatted | Extensive |
| NTFS | drive is corrupted | Extensive |
| FAT or exFAT | any | Extensive |
Microsoft gives SD cards and small USB drives as examples of FAT and exFAT drives, and those work only in Extensive mode. There are also advanced modes: /ntfs uses the master file table on a healthy NTFS drive, /segment uses file record segments, and /signature searches any file system by file headers.
Which winfr switches matter most?
These are the switches you will use most, from Microsoft's list:
| Switch | What it does |
|---|---|
/n <filter> | search by name, path, type or wildcard, for example /n *.docx |
/y:<types> | recover chosen extension groups in Signature mode |
/# | list the Signature mode extension groups |
/u | also recover undeleted files, such as ones still in the Recycle Bin |
/k | recover system files |
/o:<a|n|b> | overwrite always, never, or keep both |
/a | accept prompts, for scripts |
/? and /! | show the basic and advanced help |
Always use /n filters on your system drive. Microsoft points out that Windows writes temporary files all the time, so an unfiltered search returns a lot of unrelated results. Extensive mode on a large drive can take a long time.
When should you use PhotoRec instead?
Use PhotoRec when the drive is badly damaged, reformatted, or not a Windows drive at all. Its documentation says it ignores the file system and finds files from their contents, so it still works when the file system is gone.
- Formats: more than 480 file extensions in about 300 file families.
- File systems: at least FAT, NTFS, exFAT, ext2, ext3, ext4 and HFS+.
- Runs on: Windows, Windows Server, Linux, the BSDs, Solaris and macOS.
- Safety: it uses read-only access on the drive you are recovering from.
- Licence: GNU GPL version 2 or later.
Its step by step guide says recovered files are written into numbered recup_dir.1, recup_dir.2 folders on the destination, so expect some sorting afterwards rather than your original folder tree. As with winfr, never write the results to the same partition.
The latest stable release was 7.2, dated 22 February 2024, with a 7.3 work-in-progress beta on the download page. The download page says both tools are portable: extract the ZIP and they are ready to use, with no installer. On a Mac, the page lists brew install testdisk.
What is TestDisk for?
TestDisk is PhotoRec's companion, built mainly to recover lost partitions and make disks that will not boot bootable again. It can also undelete files from FAT, exFAT, NTFS and ext2 file systems. Reach for it when a whole drive or partition seems to have disappeared rather than a single file. It shares PhotoRec's GPL licence and download, and its source is on GitHub, where it had 2,696 stars on 22 November 2026.
What is the catch?
No free or paid tool can promise your file back.
- SSDs are hard. Microsoft warns that overwritten free space, especially on an SSD, can prevent recovery, so the sooner you try, the better.
- Every write hurts. Installing a tool, browsing the web or saving downloads to the same drive can overwrite the file. Microsoft also says not to create a new partition after data loss.
- Cloud and network folders are out. Windows File Recovery does not support cloud storage or network file shares.
- Folders may not come back. PhotoRec saves what it finds into numbered
recup_dirfolders, not your original layout. - All three are text tools. There is no friendly window, so read each command before you press Enter.
The best recovery is a copy you already have. Our guide to free file sync software shows how to keep a second copy of your folders with Syncthing or FreeFileSync, and our list of open source alternatives has free swaps for other paid Windows utilities.
Pull it. Stash it.
Questions people ask
How do I recover permanently deleted files in Windows 11 for free?
Check the Recycle Bin first, then File History if you set it up. If neither has the file, install Windows File Recovery from the Microsoft Store and run winfr with your drive, a different destination drive and Regular or Extensive mode. Stop using the drive in the meantime.
Which winfr mode should I use?
Microsoft's table says use Regular for a file deleted recently from a healthy NTFS drive. Use Extensive for files deleted a while ago, a formatted or corrupted NTFS drive, and any FAT or exFAT drive such as an SD card or small USB stick.
Can I save recovered files to the same drive?
No. Windows File Recovery requires the source and destination to be different drives, and PhotoRec's documentation also says not to write recovered files to the same partition. Writing there could overwrite the very data you are trying to get back.
Can deleted files be recovered from an SSD?
Sometimes not. Microsoft warns that overwritten free space, especially on an SSD, can prevent recovery. Try as soon as possible and do not write anything new to that drive in the meantime.
Is PhotoRec safe to use?
PhotoRec's documentation says it uses read-only access on the drive or memory card you are recovering from, and it is open source under the GNU GPL version 2 or later. You still must save its results to a different drive.
Sources
- 1Microsoft Support: Recover lost files on Windows 10 and 11 (read 2026-11-22)
- 2Microsoft Support: Backup and restore with File History (read 2026-11-22)
- 3CGSecurity: PhotoRec (read 2026-11-22)
- 4CGSecurity: TestDisk (read 2026-11-22)
- 5CGSecurity: PhotoRec step by step (read 2026-11-22)
- 6CGSecurity: TestDisk and PhotoRec download (read 2026-11-22)
- 7cgsecurity/testdisk
More repos like this
Get tomorrow's repo in your feed
One free, open source repo a day as a short video, shown working, with the catch named. Pull it. Stash it.
