Drive Restorer
Windows 10 & 11 Buy license · $29.95
Troubleshooting

How to Restore a File Removed or Quarantined by Windows Defender

File deleted or quarantined by Windows Defender? Restore it from Protection history in Windows Security, add an exclusion and know when not to.

Updated 5 minute read The Drive Restorer team

To restore a file deleted by Windows Defender, open Windows Security → Virus & threat protection → Protection history, select the detection for your file, and choose Actions → Restore. The file goes back to its original folder. If you trust the file, add an exclusion so Defender does not remove it again. Only do this when you are sure the detection is a false alarm, such as a script you wrote yourself or a tool you know is safe, because restoring real malware puts your PC at risk.

Below are the full steps, what to do when there is no Restore option, and how to tell a false alarm from a real threat.

Quarantined or removed: why it matters

Microsoft Defender Antivirus, the antivirus built into Windows 10 and 11, does one of a few things when it detects a threat:

ActionWhat happens to the fileCan you restore it?
QuarantinedMoved to a protected Defender folder in a form that cannot runYes, from Protection history
RemovedDeleted from the diskNot from Windows Security
BlockedPrevented from running or downloading, file may not have been savedAllow it, then download or run again
AllowedLeft in place because you chose to allow itNot needed

Most detections of files on your drive are quarantined, which is the easy case. Protection history tells you which action was taken.

How to restore a quarantined file

  1. Open Start, type Windows Security and open it.
  2. Click Virus & threat protection, then Protection history.
  3. Find the entry for your file. Use Filters to show only Quarantined items if the list is long. Click an entry to expand it and check the Affected items path matches your file.
  4. If Windows asks for permission, click Yes. You need an administrator account.
  5. Click Actions and choose Restore.

The file returns to the folder it was in. If Defender detects it again on the next scan, it will quarantine it again, so add an exclusion if you are sure the file is safe.

Add an exclusion so it is not removed again

  1. In Windows Security, go to Virus & threat protection.
  2. Under Virus & threat protection settings, click Manage settings.
  3. Scroll to Exclusions and click Add or remove exclusions.
  4. Click Add an exclusion and choose File, Folder, File type or Process.

Keep exclusions as narrow as you can. Excluding one file or one project folder is far safer than excluding a whole drive or your Downloads folder.

Restoring from the command line

If the Windows Security app will not open or the list does not load, you can use Defender's command-line tool from an administrator Command Prompt:

  • "%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Restore -ListAll lists quarantined items.
  • "%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Restore -Name ThreatName restores items with that threat name, using the name shown in the list.

Why there is no Restore option

  • The file was removed, not quarantined. Some detections are deleted outright.
  • You are not an administrator. Restoring needs administrator rights.
  • Your organization blocks it. On a work or school PC, administrators often prevent users from restoring or allowing detections. Contact your IT team.
  • Tamper protection or another security product is in charge. If you use another antivirus, Defender may not be the program that removed the file. Check that product's own quarantine.
  • The quarantine was cleared. Defender removes quarantined items after a period of time.

Do not try to copy files out of Defender's quarantine folder directly. Quarantined files are stored in a protected, encoded form and cannot simply be opened.

When the file was removed outright

A file that Defender removed rather than quarantined has been deleted from the disk, without going to the Recycle Bin. Your options are:

  1. Get a fresh copy from where it came from, such as your own project files, the software publisher or your email.
  2. Check backups: File History, OneDrive version history and recycle bin, or an external backup.
  3. Scan for the deleted file. Like any deleted file, its data may still be on the drive. Drive Restorer can find recently deleted files with a quick scan and show a preview and recovery chance rating before you restore. Add an exclusion first, or Defender will catch it again as soon as it is restored, and restore it to a different drive or folder you have excluded. Drive Restorer only reads the drive it scans, so the search itself does not overwrite anything.

Only recover a removed file if you are confident it is safe. If Defender removed something you did not create and do not recognize, leave it gone.

Is it really a false alarm?

False positives happen, especially with:

  • scripts and small programs you wrote or compiled yourself,
  • older or rarely used utilities from small developers,
  • password recovery, network testing and system tweaking tools,
  • game mods and key generators, which are also a common way malware spreads.

Check the threat name in Protection history. Names that mention trojans, ransomware or password stealers deserve real caution. If you downloaded the file, get it again from the publisher's official site and compare. When in doubt, do not restore it.

Stop Defender catching your own files

If you regularly build scripts, macros or small programs, Defender may keep flagging new versions of them. A few habits cut down the interruptions without weakening protection:

  • Keep your own projects in one folder, such as C:\Dev, and exclude only that folder rather than adding a new exclusion for each file.
  • Report false positives to Microsoft. Microsoft accepts file submissions through its security intelligence website, and a confirmed false positive is usually fixed in a later definition update for everyone.
  • Keep a backup of your work outside the excluded folder, so a removal is never the only copy of a file.
  • Check Protection history after updates to your tools, because a newly built file is the one most likely to be flagged.

After a real infection

If Defender caught genuine malware, and you are now missing other files, the malware itself may have deleted or hidden them. Run a Full scan from Virus & threat protection → Scan options, then read our guide to recovering files deleted by a virus. For general first steps after losing files, see what to do after accidentally deleting files.

Frequently asked questions

Where does Windows Defender put quarantined files?

Quarantined files are stored in a protected Defender folder and can be restored only from Windows Security, under Virus and threat protection, Protection history.

Is it safe to restore a quarantined file?

Only if you are sure it is a false alarm, for example a file you created yourself. Restoring real malware puts your PC at risk.

Why is the Restore option missing?

Some detections are removed rather than quarantined, and administrators can block restores. In that case a backup or a recovery scan may be your only option.

Get three guides like this every month, plus software update notices.Subscribe →