How to prevent windows defender antivirus from deleting a file of a program

Solution 1:

Add an exclusion for the download folder:

  • Go to Windows Settings > Update & Security > Windows Security > Virus & threat protection
  • Under Virus & threat protection settings, click Manage settings
  • Under Exclusions, click Add or remove exclusions
  • Click Add an exclusion, and choose File or Folder

You may this way exclude the download folder, or exclude an executable.

Solution 2:

Put the following in a file named disable_real_time_protection.reg and save it. Double click that file and you are done. To undo, just change the 1 in the dword values to a 0 and repeat the instructions above.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection]
"DisableRealtimeMonitoring"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
"DisableAntiSpyware"=dword:00000001