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


Step-by-Step Guide: Adding Folder Exclusions via Regedit

1. Open the Registry Editor

  1. Press Win + R on your keyboard to open the Run dialog.
  2. Type regedit and press Enter.
  3. Select Yes when prompted by User Account Control (UAC).

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:

  1. Right-click the Windows Defender key in the left panel.
  2. Select New > Key and name it Exclusions.
  3. Right-click the newly created Exclusions key.
  4. 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

  1. Select the Paths key in the left panel.
  2. Right-click in the empty space in the right-hand pane.
  3. Select New > DWORD (32-bit) Value.
  4. Set the Value name to the exact file path of the folder you want to exclude (e.g., C:\Development\Project).
  5. Double-click the newly created value and ensure its Value data is set to 0.
  6. 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.