How to Make Windows Security Ignore a File
If Windows Security keeps blocking a file you trust, you can create a Microsoft Defender exclusion for that file. This tells Defender to leave that one item alone instead of changing protection for your whole computer.
Use the narrowest option you can. A single-file exclusion is safer than excluding an entire folder. Before you add one, make sure the file really is safe.
What it means to make Windows Security ignore a file
Microsoft Defender Antivirus, which is part of Windows Security, can check files for threats. If it sees a problem, it may block the file, quarantine it, or remove it.
An exclusion tells Defender not to scan a chosen item in the usual way. You can exclude:
- One specific file
- A whole folder
- A process, such as a particular program
This can solve several different problems:
- A trusted file is stopped from opening.
- A file is blocked when you download or run it.
- A file is removed after Defender detects it.
- A program needs to work with files in one known folder.
An exclusion is not the same as marking a file as safe everywhere. It only changes how Microsoft Defender treats the item on that Windows installation. Other security tools may still scan it.
The Windows Security app uses sections called Virus & threat protection and Virus & threat protection settings. That is where most home users should create an exclusion.
Check the file before adding an exclusion
A warning does not always mean Windows has made a mistake. If Defender flags a file, pause before telling it to ignore the file.
Ask yourself:
- Did you get it from a person or website you trust?
- Were you expecting the file?
- Does its name match what you thought you downloaded?
- Does the program need this file, or can you remove the program instead?
- Could your child or another person have downloaded it without knowing what it is?
Be especially careful with files that run programs, such as `.exe`, `.bat`, `.cmd`, or script files. If you're unsure, don't add an exclusion just to make the warning disappear. Check the file with the person or organisation that provided it first.
If one file is safe and the rest of its folder is unknown, exclude the file only. That keeps the change as small as possible.
How to create a file exclusion in Windows 11
Windows 11 puts the setting in the Windows Security app. You don't need to turn off real-time protection to add a single-file exclusion.
- Open the Start menu.
- Type Windows Security.
- Open the Windows Security app.
- Select Virus & threat protection.
- Under Virus & threat protection settings, select Manage settings.
- Scroll to Exclusions.
- Select Add or remove exclusions.
- If Windows asks for permission, approve the change.
- Select Add an exclusion.
- Choose File.
- Browse to the file you want Defender to ignore.
- Select the file, then confirm your choice.
The file should now appear in the exclusions list. Leave the other protection settings alone.
If you can't find the option, make sure you're in Virus & threat protection, not the general Windows Security home screen. The wording can also look slightly different after a Windows update, but the path still uses the protection settings and the exclusions area.
If you only need to stop one block
A single-file exclusion is usually the right choice when a known program has one file that Defender keeps blocking. You don't need to exclude the program's whole installation folder.
After adding the exclusion, try the file again. If the program still fails, the problem may not be Microsoft Defender. The file could be damaged, missing another component, or blocked by another security setting.
How to create a file exclusion in Windows 10
On Windows 10, you can reach the same setting through Windows Security. The older Settings path starts with Start > Settings > Update & Security.
- Select Start.
- Open Settings.
- Select Update & Security.
- Choose Windows Security in the left-hand menu.
- Select Virus & threat protection.
- Under Virus & threat protection settings, select Manage settings.
- Scroll down to Exclusions.
- Select Add or remove exclusions.
- Select Add an exclusion.
- Choose File.
- Find and select the file you want to exclude.
That creates a file exclusion for the selected item. It doesn't disable Microsoft Defender's wider protection.
On some Windows 10 computers, you may reach Windows Security by searching for it from the Start menu instead. Once the app is open, look for Virus & threat protection, then open its settings.
How to exclude a folder instead of a single file
Sometimes a program creates or changes several files in one folder. In that case, excluding the folder may be more practical than adding each file separately.
The steps are nearly the same in Windows 10 and Windows 11:
- Open Windows Security.
- Go to Virus & threat protection.
- Open Manage settings under Virus & threat protection settings.
- Select Add or remove exclusions.
- Select Add an exclusion.
- Choose Folder.
- Select the folder to exclude.
A folder exclusion covers the files inside that folder. That makes it wider than a file exclusion, so use it only when you need that wider coverage.
For example, if one trusted tool needs access to several files in its own folder, a folder exclusion may make sense. If you're only trying to run one downloaded file, don't exclude the folder containing all your downloads.
Keep the folder as specific as possible. Excluding a small application folder is different from excluding an entire drive or a broad folder such as your whole user profile.
File, folder, and process exclusions: which option to choose
The three choices solve different problems.
File exclusion
Choose File when one known file is being blocked or scanned and you don't need to change how Defender treats nearby files.
This is the best starting point for most household situations. It gives you the smallest change and is easier to remove later.
Folder exclusion
Choose Folder when a trusted program regularly uses several files in one particular folder and excluding just one file doesn't solve the problem.
Remember that new files placed in the excluded folder may also avoid Defender's normal checks. Don't use this option for a general downloads folder or a folder shared by several people unless you understand the risk.
Process exclusion
Choose Process when a particular program process needs to work without the same Defender checks. A process is a running program, such as an application shown in Task Manager.
This option can affect files handled by that process, so it may be broader than a single-file exclusion. It is usually a better fit for managed computers or a known application problem than for a random file that was downloaded at home.
If you're unsure, use this order:
- Try a file exclusion.
- Use a folder exclusion only if the program needs several files there.
- Use a process exclusion only when you know the application itself needs it.
What to do when Windows Security blocks or deletes the file
Creating an exclusion is useful when Defender keeps blocking a file you have checked. It may not bring back a file that has already been quarantined or deleted.
First, open Windows Security and go to Virus & threat protection. Look for Protection history and review the alert. Check the file name, location, and reason for the detection.
If the history offers a restore or allow option, use it only after you've decided the file is trustworthy. The exact choices can depend on the alert and the state of the file.
After restoring the file, add the narrow file exclusion through the steps above if Defender blocks it again. This handles the two separate parts of the problem:
- The protection history deals with the file that was already blocked or quarantined.
- The exclusion tells Defender how to treat that file in future checks.
Don't add an exclusion just because a program says it needs one. A malicious program can also ask you to bypass antivirus protection. If the file came from an unknown source, removing it is safer than trying to prevent Windows Security from deleting it.
If the file is needed by your child for school or by someone else in your home, ask where it came from and why it needs the exclusion. That short check can prevent a much bigger problem.
PowerShell, Intune, MDM, and Group Policy options
The Windows Security app is the simplest route for one home computer. Administrators can also manage exclusions with PowerShell or with tools used across many Windows devices.
Add an exclusion with PowerShell
Open PowerShell with administrator permission, then use `Add-MpPreference`.
To exclude a folder:
```powershell
Add-MpPreference -ExclusionPath "C:\TrustedApp\Data"
```
To exclude one file, use its full path:
```powershell
Add-MpPreference -ExclusionPath "C:\TrustedApp\Data\settings.dat"
```
To add a process exclusion:
```powershell
Add-MpPreference -ExclusionProcess "C:\TrustedApp\App.exe"
```
The path must point to the actual file, folder, or program. Replace the example paths with the ones on your computer.
You can view the current Defender preferences with:
```powershell
Get-MpPreference
```
To remove an exclusion later, use the matching removal command. For a folder or file path:
```powershell
Remove-MpPreference -ExclusionPath "C:\TrustedApp\Data"
```
For a process:
```powershell
Remove-MpPreference -ExclusionProcess "C:\TrustedApp\App.exe"
```
PowerShell changes should be made carefully. A typo in a path can create the wrong exclusion, and a broad path can cover more files than you intended.
Managed computers
Schools, workplaces, and other organisations may manage Defender settings centrally. In those environments, exclusions can be configured through Microsoft Intune, mobile device management (MDM), or Group Policy.
Those options are useful when the same narrow exclusion must be applied to many managed computers. They aren't usually needed for a parent fixing one trusted file on a family PC.
If a school or employer manages the device, a local change may be blocked or later replaced by its central settings. Ask the administrator rather than trying to work around the management rules.
Use the smallest necessary exclusion, and remove it when the file or program no longer needs special treatment. That leaves Windows Security checking as much of your computer as it can.