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

43,559

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
Share:
43,559

Related videos on Youtube

Iffat
Author by

Iffat

Updated on September 18, 2022

Comments

  • Iffat
    Iffat almost 2 years

    I am developing an app in react native. During installing an app (when I run its run-android command in cmd) in emulator antivirus is deleting an exe file as soon as it's downloaded. So how can I prevent from deleting a file it.

    • harrymc
      harrymc almost 5 years
      Add an exclusion for the download folder.
    • Akina
      Akina almost 5 years
      .. and after downloading add an exclusion for downloaded .EXE. If file is already downloaded and deleted then you can restore it and set as exclusion.
  • Iffat
    Iffat almost 5 years
    thanks...but after adding exclusion the file is still deleting
  • harrymc
    harrymc almost 5 years
    Do you have another antivirus installed than Windows Defender?
  • Iffat
    Iffat almost 5 years
    no..i have only one, windows 10 inbuilt antivirus
  • harrymc
    harrymc almost 5 years
    This should not be happening. See in Settings > Update & Security > Windows Security > Virus & threat protection > Protection history, click the down-arrow of the last entry of "Threat blocked" and let me know the details that are displayed.
  • Ramhound
    Ramhound about 4 years
    This is dangerous advice....Why do you advise disabling protection instead of just creating an exception, which the author accepted as the solution to their problem, over a year ago?
  • user3763403
    user3763403 about 4 years
    Well Ramhound, the thing about the Internet is that things (like this question) tend to stick around awhile. Just because the OP accepted an answer doesn't mean it is the only way to do something. If that were the case then Exchange sites wouldn't allow new answers after a year. Addressing your claim that this is dangerous advice, I would agree for the average user it is not a good idea to disable AV, but if someone is here looking at the answers to this question the already know what they want to do, they just don't know how to do it. Exceptions don't always work. Example in next comment...
  • user3763403
    user3763403 about 4 years
    Example: if you have a network drive, windows isn't constantly scanning it like it does your C drive. I've been collecting SW for 20 years on my server and found that Windows 10 will delete files from directories I browse on my server if it thinks the files are malicious and will not alert me. Since I'm not alerted I don't know the file was delete, and since I have rolling backups, after 2 months that file is gone forever if I don't notice the deletion. In short, you can't add an exception if you don't know what to add an exception for, and once a file is gone it may be gone for good.
  • mukunda
    mukunda almost 3 years
    God this is so annoying.
  • gies0r
    gies0r over 2 years
    For security reasons, do yourself a favour and NEVER ADD AN EXCEPTION FOR THE COMPLETE DOWNLOADS FOLDER. Move the executable to a different folder and add an exception there. Otherwise, you whitelist all the ugly stuff which comes from Internet.