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.

  • 1
    Add an exclusion for the download folder.
    – harrymc
    Jul 11, 2019 at 11:55
  • .. 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.
    – Akina
    Jul 11, 2019 at 12:06

2 Answers 2


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.

  • thanks...but after adding exclusion the file is still deleting
    – Iffat
    Jul 11, 2019 at 14:21
  • 1
    Do you have another antivirus installed than Windows Defender?
    – harrymc
    Jul 11, 2019 at 15:06
  • no..i have only one, windows 10 inbuilt antivirus
    – Iffat
    Jul 12, 2019 at 5:05
  • 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.
    – harrymc
    Jul 12, 2019 at 5:57
  • God this is so annoying.
    – mukunda
    Jul 16, 2021 at 22:00

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]

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
  • 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?
    – Ramhound
    Apr 20, 2020 at 22:39
  • 3
    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... Apr 21, 2020 at 4:42
  • 4
    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. Apr 21, 2020 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.