How to Exclude Folders in Windows Defender via Registry
Configuring Windows Defender to bypass specific directories is an effective way to optimize performance for development environments or prevent false-positive detections on trusted files. This guide details how to create custom folder exclusions in Microsoft Defender using the Windows Registry Editor (Regedit).
Prerequisites
- Administrator privileges on the target Windows machine.
- The exact folder path you intend to exclude (e.g.,
C:\MyFolder).
Step-by-Step Guide: Adding Folder Exclusions via Regedit
1. Open the Registry Editor
- Press
Win + Ron your keyboard to open the Run dialog. - Type
regeditand press Enter. - Select Yes when prompted by User Account Control (UAC).
2. Navigate to the Windows Defender Key
In the Registry Editor address bar, paste the following path and press Enter:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender
3. Create the Exclusions and Paths Subkeys
If the Exclusions or Paths keys do not
exist, you must create them manually:
- Right-click the
Windows Defenderkey in the left panel. - Select New > Key and name it
Exclusions. - Right-click the newly created
Exclusionskey. - Select New > Key and name it
Paths.
The final path should be:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions\Paths
4. Add the Folder Exclusion
- Select the
Pathskey in the left panel. - Right-click in the empty space in the right-hand pane.
- Select New > DWORD (32-bit) Value.
- Set the Value name to the exact file path of the
folder you want to exclude (e.g.,
C:\Development\Project). - Double-click the newly created value and ensure its Value
data is set to
0. - Click OK.
5. Apply the Changes
Close the Registry Editor. For the changes to take full effect across the system and the Windows Defender service, restart your computer.
How to Remove an Exclusion
To remove an excluded folder at any time: 1. Navigate back to
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions\Paths.
2. Locate the DWORD entry matching the folder path you want to restore
to active scanning. 3. Right-click the entry and select
Delete. 4. Confirm the deletion and restart your
computer.