Does Microsoft Defender Path Exclusion with Asterisk Exclude Subfolders?
Question details
The user wants to know if appending an asterisk (*) to a folder path in Microsoft Defender exclusions applies recursively to 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.
Ensure you have administrative privileges on your Windows computer to view or modify Microsoft Defender exclusion settings.
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.
Determine the exact path of the directory you want to completely exclude from Microsoft Defender scans, for example, E:\data.
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.
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'.
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.

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.

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.




