You can recover deleted files in Windows without installing extra software in several cases: press Ctrl+Z straight after the delete, restore from the Recycle Bin, roll back with File History or Previous Versions, or retrieve the file from OneDrive's recycle bin. These built-in options only work if the file went to the Recycle Bin or a backup feature was already on. If the Recycle Bin has been emptied and there is no backup, you need a tool that scans the drive, such as Microsoft's command-line Windows File Recovery or a recovery program with a preview.
Work through these methods in order. Each one takes a few minutes and none of them writes over your deleted data.
Method 1: Undo the delete with Ctrl+Z
If you only just deleted a file or folder in File Explorer, press Ctrl+Z while the same File Explorer window is active. Windows reverses the last file operation, putting the file back where it was.
- It works for normal deletes to the Recycle Bin, and also for moves and renames.
- It does not work for Shift+Delete, or after you have done other file operations since.
- You can also right-click an empty area in the folder and choose Undo Delete (in Windows 11, under Show more options if needed).
Method 2: Restore from the Recycle Bin
- Open Recycle Bin from the desktop. If the icon is hidden, type
shell:RecycleBinFolderinto the File Explorer address bar. - Use the search box or sort by Date Deleted in Details view.
- Select the items and choose Restore the selected items, or right-click → Restore.
Files go back to their original folders. If the original folder no longer exists, Windows recreates it. To put a file somewhere else instead, drag it from the Recycle Bin window to the folder you want. If you have several drives, remember that each one has its own bin, but the Recycle Bin window shows items from every connected drive together.
The bin does not hold Shift+Deleted files, files deleted from USB flash drives or SD cards, network drive deletes, command-line deletes or items too large for the bin. Our guide to how long the Recycle Bin keeps files explains its limits.
Method 3: File History
File History saves copies of your libraries, Desktop and other chosen folders to an external or network drive at regular intervals. It is off by default, so it only helps if it was turned on before the delete.
- Open Control Panel → System and Security → File History.
- If it shows as on, click Restore personal files.
- Browse to the folder where the file was. Use the arrow buttons at the bottom to move back through dates.
- Select the file and click the green Restore button. To put it somewhere else, click the gear icon and choose Restore to.
Make sure the File History backup drive is connected first. If File History is off, turning it on now will not bring back files deleted earlier, but it is worth doing once you have finished recovering. In Windows 11 you can also use the Windows Backup app to back up your folders to OneDrive.
Method 4: Previous Versions
The Previous Versions tab shows older copies of a folder taken by File History or by restore points (System Protection).
- Right-click the folder that contained the deleted file and choose Properties.
- Open the Previous Versions tab.
- Select a version from before the delete and click Open to browse it.
- Copy the file you need to a safe place.
If you see "There are no previous versions available", neither feature captured that folder. System Restore itself does not bring back personal files, so do not run it hoping to recover documents.
Method 5: OneDrive and other cloud storage
If the file was in a OneDrive-synced folder, deleting it on your PC also deleted it from OneDrive, but it went to OneDrive's online recycle bin.
- Sign in at the OneDrive website with the same Microsoft account.
- Click Recycle bin in the left-hand menu.
- Select the files and click Restore. They sync back to your PC.
Personal OneDrive accounts keep deleted items for 30 days. Work or school accounts keep them for 93 days by default. If a file was overwritten rather than deleted, right-click it on the OneDrive website and choose Version history. Other cloud storage services usually offer similar recycle bins and version history on their websites.
Quick reference: which method fits your situation
| What happened | Built-in method that can help |
|---|---|
| Deleted seconds ago in File Explorer | Ctrl+Z |
| Normal delete, bin not emptied | Recycle Bin |
| File in a OneDrive folder | OneDrive recycle bin or version history |
| File History was on | File History or Previous Versions |
| Restore points on the system drive | Previous Versions (sometimes) |
| Bin emptied or Shift+Delete, no backups | A scanning tool is needed |
| Deleted from a USB stick or SD card | A scanning tool is needed |
What about Command Prompt?
Many tutorials suggest a "CMD trick" to recover deleted files, usually attrib -h -r -s /s /d E:\*.*. That command only removes hidden, read-only and system attributes. It helps when files are hidden, for example by malware on a USB stick, but it cannot bring back deleted files.
Microsoft does offer a genuine command-line recovery tool: Windows File Recovery, a separate download from the Microsoft Store that adds the winfr command. It scans a drive for deleted files and copies them to another drive. It has no preview and you need to get the syntax right, but it is a real option. See our guide to using Windows File Recovery.
When built-in tools are not enough
If none of the methods above find your files, the data may still be on the drive, waiting to be found by a scan. A program like Drive Restorer reads the drive without writing to it, runs a quick scan for recently deleted files and a deep scan by file signature, and lets you preview photos, videos and documents before restoring them to a different drive. Drive Restorer also rates each file's recovery chance, from excellent to overwritten, so you know what you are getting back. Act quickly, because every write to the drive lowers your chances.
Once your files are back, turn on File History or OneDrive folder backup so the built-in methods are there for you next time.
Frequently asked questions
Can CMD recover deleted files?
Not on its own. Commands such as attrib can only reveal hidden files. Microsoft's separate Windows File Recovery app adds a winfr command that can scan for deleted files.
Does Windows keep backups automatically?
Not by default. File History and OneDrive folder backup must be turned on. Restore points may also keep previous versions of files on the system drive if System Protection is on.
How long does OneDrive keep deleted files?
Items deleted from OneDrive go to the OneDrive recycle bin, which keeps them for 30 days on personal accounts and 93 days by default on work or school accounts.
