Security Policy Errors

Does Microsoft Defender Path Exclusion with Asterisk Exclude Subfolders?

John WilsonJohn Wilson Oct 9, 2026 869 views

Question details

The user wants to know if appending an asterisk (*) to a folder path in Microsoft Defender exclusions applies recursively to subfolders.

Does Microsoft Defender Path Exclusion with Asterisk Exclude Subfolders?
Product
Microsoft Defender
Device & OS
Windows
Scenario
Configuring Microsoft Defender path exclusions using wildcard characters to bypass specific directories.
Observed behavior
The user needs clarification on whether a path exclusion ending in an asterisk (e.g., E:\data\*) applies to all subdirectories or only to the files directly inside the root folder.
Before you start

Ensure you have administrative privileges on your Windows computer to view or modify Microsoft Defender exclusion settings.

Solution 1Recommended

Understanding Defender Wildcard Exclusions and Excluding Subfolders

Explains the behavior of the asterisk (*) wildcard in Microsoft Defender and how to correctly exclude a folder along with all its subfolders.

In Microsoft Defender, using an asterisk at the end of a path (such as E:\data\*) only applies to files directly inside that specific folder. It acts as a file or extension pattern for the final folder, not a recursive folder exclusion.

Therefore, it does not apply to files stored in subfolders (e.g., E:\data\folder1\file1.txt). If your goal is to exclude a folder and all its contents, you should add the folder path without any trailing wildcards.

1
Identify the target folder

Determine the exact path of the directory you want to completely exclude from Microsoft Defender scans, for example, E:\data.

2
Open Windows Security

Click the Start menu, type 'Windows Security', and press Enter to open the application. Navigate to the 'Virus & threat protection' tab on the left sidebar.

3
Access Exclusion Settings

Under the 'Virus & threat protection settings' heading, click on the 'Manage settings' link. Scroll down to the bottom of the page to find the 'Exclusions' section, then click 'Add or remove exclusions'.

4
Add the correct folder exclusion

Click the 'Add an exclusion' button and select 'Folder' from the drop-down menu. Browse to your target folder (e.g., E:\data) and select it. By adding the folder itself without the asterisk, Microsoft Defender will automatically and recursively exclude all files and subfolders within it.

Understanding Defender Wildcard Exclusions and Excluding Subfolders
Wildcard Usage: Use wildcards like * or ? only when you need to exclude specific file types or files with varying names within a single directory, rather than for recursive folder exclusions.
Free Microsoft Office alternative

Looking for a Secure and Free Office Suite?

While you manage your Windows security settings, if you need a reliable and safe office productivity suite, consider WPS Office. It is a lightweight, highly compatible alternative to Microsoft Office that is free to use and seamlessly supports all major document formats.

Fully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx)Lightweight installation that runs smoothly without triggering system security conflictsFamiliar user interface for a seamless and quick transitionIncludes built-in PDF editing and document protection features
microsoft office alternative - wps office

Frequently Asked Questions

How do I exclude an entire drive in Microsoft Defender?

To exclude an entire drive, go to Windows Security > Virus & threat protection > Manage settings > Add or remove exclusions. Click 'Add an exclusion', select 'Folder', and then select the root of the drive (e.g., E:\).

Can I use environment variables in Defender exclusions?

Yes, Microsoft Defender supports environment variables like %USERPROFILE% or %APPDATA% for path exclusions, which is highly useful when configuring security rules across multiple user accounts.

Why is my Microsoft Defender exclusion not working?

Exclusions might fail if the path is typed incorrectly, lacks administrative permissions, or if group policies overwrite local settings. Ensure there are no typos and that you haven't misused wildcards like trailing asterisks when attempting to exclude subfolders.