If you need to stop Windows Defender from deleting files, this guide shows simple ways to whitelist programs, adjust security settings, and protect critical data from unwanted removals while keeping your PC safe and fully under your control.
Before you start changing settings, it helps to understand what Defender is doing behind the scenes.
Common Reasons Your Files Get Flagged
Windows Defender may delete a file because:
Sometimes Defender is right. Other times… it's just being overly protective.
When You Should Not Disable Protection
Here’s the rule of thumb:
➡ If you’re not 100% sure the file is safe, don’t disable protection.
➡ If the file comes from a random website, double-check it first.
Your PC’s security comes before convenience.
This guide walks you through multiple safe and effective ways to stop Windows Defender from deleting files, without putting your entire system at risk.
If Defender already deleted your file, don’t panic—you can restore it.
Step-by-Step: Restore Files from Protection History
1. Open Start Menu. Type Windows Security and open it
2. Go to Virus & threat protection. Click Protection history.
3. Find the blocked or removed file. Select Allow on device.
That’s it! The file will no longer be deleted automatically.
Add an Allowed Threat
If you want Defender to never delete that file again:
1. Go to Windows Security. Choose Virus & threat protection.
2. Click Manage settings under Virus & threat protection settings.
3. Scroll down to Add or remove exclusions. Add your file or folder.
This tells Windows Defender, "Hey, leave this one alone".
This is the safest long-term way to stop Defender from messing with your files.
Step-by-Step: Add Exclusions in Windows Security
1. Open Windows Security. Go to Virus & threat protection. Click Manage settings.
2. Scroll down to Exclusions. Click Add or remove exclusions.
3. Select File, Folder, File type, or Process.
You can exclude:
What You Can Safely Exclude
Safe items to exclude include:
Avoid excluding entire drives or system folders—that’s risky.
If you need to open one file just once without Defender blocking it, this method works perfectly.
When This Method Is Useful
Risks of Turning Off Real-Time Protection
Turning off real-time protection means:
So only use this method if you fully trust the file.
If you're using Windows 10/11 Pro, this method gives you full control.
Step-by-Step Instructions
1. Open Run (Win + R).
2. Type: gpedit.msc.
3. Navigate to: Computer Configuration → Administrative Templates → Windows Components → Microsoft Defender Antivirus.
4. Double-click Turn off Microsoft Defender Antivirus. Select Enabled.
5. Click Apply → OK. Restart your PC.
Done!
What If Group Policy Is Missing?
If you're using Windows Home, Group Policy isn’t included by default. But don’t worry—there’s another solution.
Warning: Editing the Registry can break Windows if you’re careless. Follow the steps EXACTLY.
Step-by-Step Instructions
1. Press Win + R. Type regedit.
2. Navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender.
3. Right-click → New → DWORD (32-bit) Value. Name it: DisableAntiSpyware.
4. Double-click it. Set value to 1. Restart your PC.
Windows Defender should now be disabled.
How to Undo Registry Changes
Just delete the DisableAntiSpyware entry and reboot your system.
Sometimes Defender permanently deletes files, especially if they're quarantined too long. That’s where MyRecover, a professional Windows data recovery tool, saves the day. You may need it when:
How MyRecover Helps Recover Files Easily
MyRecover can:
1. Install MyRecover – Download and open the program.
2. Select Drive – Pick the drive where the file was deleted.
3. Scan – Click Scan to search for deleted files.
4. Find File – Browse or search for the file you want.
5. Recover – Select it and click Recover, saving it to a safe location.
1. Check Files with VirusTotal
If you’re unsure whether a file is safe:
1. Go to virustotal.com.
2. Upload your file.
3. Read the report.
If only 1 or 2 engines flag it, it’s likely a false positive.
2. Keep Backups on External or Cloud Drives
A deleted file is only a problem if you don’t have a backup. Use:
A quick backup can save you hours of frustration.
Stopping Windows Defender from deleting your files doesn’t have to be complicated. Whether you want to temporarily disable protection, permanently exclude trusted items, or restore files already deleted, you now have multiple effective methods to choose from.
Just remember: keep security in mind, exclude only trusted files or folders, and use tools like MyRecover if Defender wipes something important.
Windows Defender is powerful—but now you have the power to control it.