How to prevent Windows Defender from deleting program files in Windows 10

Windows Defender is always running and scanning your system when it’s idle. On average, the antivirus scans your system twice a week to make sure there is nothing malicious on it. This does not mean that it is “off” or “disabled” outside of these scanning periods. Not only does it scan your system for new files, but it proactively removes any files it deems malicious. This means that if you download an executable file that Windows Defender thinks is malicious, it will delete it before you can even open File Explorer to see where the file was downloaded. Here’s how to prevent Windows Defender from deleting an executable file.

The Windows 10 operating system has built-in virus protection called Windows Defender, which allows all users to make sure that viruses, malware, and other threats won’t affect the system. However, there have been instances where users have reported that certain files have been deleted by Windows Defender. You may wonder if a certain file is not even a threat, why would Windows Defender delete it?

If you have encountered this situation, you are in the right place. But before you continue with possible workarounds, you should install another powerful antivirus program so that you don’t have to compromise the security of your computer even if you disable Windows Defender.


What makes Windows Defender delete program files on Windows 10

What makes Windows Defender delete program files on Windows 10

Windows Defender flags files that it deems unsafe and should not be allowed to run on your system. It is extremely rare to get a false positive, but it can happen. So you should remember that you are taking a big risk if you run an application that Windows Defender has classified as dangerous.

Do all the necessary checks before launching the application. If it is a malicious application, it may not be immediately obvious, and by the time you realize that the application has hacked something, you will no longer be able to get rid of it.

Although it’s not very common, sometimes Windows Defender will see a program or file as a threat and won’t even let you install it. In more extreme cases, it will simply delete it without your prior confirmation.


How can I prevent Windows Defender from deleting files in Windows 10

How can I prevent Windows Defender from deleting files in Windows 10

Recover deleted files from Windows 10

If your important files have been deleted or erased by Windows 10 and you can’t recover them, don’t worry. One of the best file recovery software can easily recover lost files in three steps. It allows you to recover deleted files from recycling garbage can, hard drive, SSD, USB flash drive, external hard drive, digital camera, and more.

  1. Select a location and start the scanning process. Start the data recovery wizard, place your mouse cursor on the location (hard drive partition, external hard drive, device cards) where you lost data, and click the “Scan” button.
  2. Preview and select files. Wait until the scan finishes. If you need to double-click an item to preview the file, select the data you want to recover.
  3. Recover lost data. Click “Recover”, select a location for the recovered data and click “OK”. You must save the data to a different location than the original.
Fixed “Automatic file deletion” bug in Windows 10

After deleting all the lost files from your Windows system, you can now use the below solutions to fix Windows 10 file deletion issue.

Stop Windows Defender from automatically deleting files

  1. Open “Windows Defender” -> Click on “Virus and Threat Protection”.
  2. Scroll down and click on “Settings for virus and threat protection”.
  3. Scroll to “Exceptions” and click “Add or remove exceptions”.
  4. Click the plus icon to add an exception and select a file, folder, file type, or process. Then specify the exact files, folders, or even file types that you don’t want Windows Defender to remove or delete.
  5. Save your changes. If you don’t want Windows Defender to remove .dll files, click File Types and enter the .dll and .exe file extensions, then click Add. After that, the files that you set as excluded will not be deleted or erased.

Disable Storage Sense to prevent Windows 10 from automatically deleting files

Storage Sense is a new feature in Windows 10. When you turn it on, Windows automatically deletes unused files when your computer runs out of storage space. For example, it can automatically delete files older than 30 or 60 days from the Recycle Bin or delete temporary files to free up disk space. It can also delete old files from the Downloads folder.

But if you don’t want Storage Sense to delete files on its own, you can change the default settings to prevent Windows 10 from automatically deleting files that you want to keep.

  1. Open the Settings app. Click System -> Storage. You can toggle the “Storage Sense” switch to the “Off” position.
  2. If you don’t want to disable this feature completely, you can change the Storage Sense configuration by clicking on “Change how storage is automatically shared”.
  3. Click on the “Remove files from Recycle Bin if they have been there for a long time” field and select “Never”. Also, click the “Remove files from the Downloads folder if they have been there for a long time” box and select “Never”.
Remove erroneous updates that delete files in Windows 10

As we all know, sometimes a newly installed Windows system deletes files on your computer without asking your permission. It seems that if you installed an incompatible or erroneous Windows 10 update, it will delete or erase your files on your PC.

So the easiest way to remove erroneous updates is to delete the files on your Windows 10 PC. Here are the detailed steps on how to delete erroneous updates:

  1. Press the Windows + X keys and select “Control Panel”.
  2. Click on “Programs and Features” and select “View installed updates.”
  3. Click the Installed column header to sort updates by date.
  4. Locate the large updates you recently downloaded, right-click on them, and select “Uninstall”.
  5. Once the uninstall process is complete, restart your computer.

Note: If you want to install the latest Windows 10 update, you can go to the official Microsoft Windows 10 update site to download Windows 10 ISO and then install it on your PC.


Frequently Asked Questions

  1. Go to Windows Settings -> Updates and Security -> Windows Security -> Virus and Threat Protection.
  2. In the Antivirus and Threat Protection section, click Manage Settings.
  3. In the Exceptions section, click Add or remove exceptions.
  4. Click Add Exception, and then select File or Folder.

The Windows operating system has built-in virus protection called Windows Defender. When the security program is configured to detect and remove threats on your device, Windows Defender Antivirus quarantines suspicious files. However, sometimes Windows Defender deletes files that are not necessarily a threat.

Some users report that their desktop files are "deleted" after installing an update. Their taskbars and start menus are also reset to their default settings. The files appear to be deleted because Windows 10 writes some people to a different user profile after installing the update.

  1. Open Settings.
  2. Click on System.
  3. Click on Storage.
  4. Click on the option to Change how the memory is automatically freed.
  5. Under Temporary Files, use the Delete files from the Downloads drop-down menu and select the Never option.

Website | + posts

Mark Ginter is a tech blogger with a passion for all things gadgets and gizmos. A self-proclaimed "geek", Mark has been blogging about technology for over 15 years. His blog,, covers a wide range of topics including new product releases, industry news, and tips and tricks for getting the most out of your devices. If you're looking for someone who can keep you up-to-date with all the latest tech news and developments, then be sure to follow him over at Microsoft.