Microsoft Defender Antivirus scans files and processes in the background as you open or download them. Occasionally that gets in the way: a trusted tool you rely on keeps being flagged, or a folder of work files you know are safe is constantly being checked. Rather than switching Defender off, Windows Security lets you add an exclusion for a specific file, folder, file type or process. This guide follows Microsoft's Windows Security support documentation, checked on 30 November 2026.
Before you start: understand the risk
Microsoft is blunt about this. Adding an exclusion means Microsoft Defender Antivirus "will no longer check those types of files for threats, which could leave your device and data vulnerable". Only exclude something you're certain is safe, ideally software you downloaded from the developer's official site, and keep exclusions as narrow as possible: a single file is safer than a folder, and a folder is safer than a whole file type.
Microsoft also notes that an exclusion is safer than turning real-time protection off altogether. If you do turn real-time protection off, files you open or download won't be scanned while it's off, although Microsoft says it turns itself back on automatically after a short while.
If you think Defender has wrongly flagged a file, consider sending it to Microsoft rather than (or before) excluding it: Windows Security's settings include a Submit a sample manually option.
How to add an exclusion
Open the Windows Security app (search for it from the Start menu).
Select Virus & threat protection.
Under Virus & threat protection settings, select Manage settings.
Scroll down to Exclusions and select Add or remove exclusions.
Choose one of the four exclusion types below, then pick the file or folder, or enter the file extension or process name.
The four exclusion types
Type | What Microsoft says it does | When it makes sense |
|---|
File | Excludes a specific file | A single trusted tool that's repeatedly flagged |
Folder | Excludes a specific folder and all of the files within it | A folder of your own project or work files you know are safe |
File type | Excludes all files of a specified type, such as .docx or .pdf | Rarely; this is the broadest option |
Process | Any file opened by that process is excluded from real-time scanning | Trusted software that opens lots of files |
For process exclusions, Microsoft recommends using the full path and file name, because this "makes it less likely that malware could use the same filename as a trusted and excluded process and evade detection".
What an exclusion does and doesn't cover
Microsoft says exclusions only apply to real-time scanning with Microsoft Defender Antivirus. Scheduled scans, or third-party anti-malware products, might still scan those files or processes. For process exclusions specifically, the files that process opens are still scanned by on-demand or scheduled scans, unless you've also created a file or folder exclusion that covers them.
That's useful to know: an excluded file can still turn up in a scheduled scan. For the differences between scan types, see Microsoft Defender Quick Scan vs Full Scan.
Using wildcards and environment variables
Windows Security accepts the asterisk (*) as a wildcard for any number of characters. Microsoft gives these examples:
File type: an extension of *st excludes .test, .past, .invest and any other file type whose extension ends in "st". Be careful, because a short wildcard can match far more than you intend.
Process: C:\MyProcess\* excludes files opened by all processes located in C:\MyProcess or any of its subfolders, and test.* excludes files opened by all processes named test, regardless of the file extension.
You can also use environment variables in process exclusions. Microsoft's example is %ALLUSERSPROFILE%\CustomLogFiles\test.exe, which excludes any files opened by C:\ProgramData\CustomLogFiles\test.exe.
How to remove an exclusion
Exclusions are easy to forget, so review them now and then. Go back to Virus & threat protection > Manage settings > Add or remove exclusions, select the exclusion you no longer need and select Remove.
Tamper protection and Controlled folder access
Tamper protection, which Microsoft says helps prevent malicious apps from changing important Defender settings, doesn't stop you as an administrator changing settings in the Windows Security app; it stops other apps doing so. Our guide on how to turn on Tamper Protection in Windows 11 explains more.
If an app is being blocked from saving to your Documents or Pictures folders rather than being flagged as malware, the cause is probably Controlled folder access, not a detection. That needs an allowed app, not an exclusion; see how to turn on ransomware protection in Windows 11.