Custom export

How to export and import only specific firewall rule on Windows 10

Yes, it's possible to export and import only one firewall rule on Windows 10, but you need to use the Registry with this workaround.

Windows Defender Firewall export and import single firewall rule

Windows Defender Firewall is a feature on Windows 10, which monitors incoming and outgoing network traffic to allow or block traffic depending on predefined rules.

Although every Windows 10 installation has the same set of default rules, you can always create new custom rules to allow or block apps from accessing the network. However, using the Windows Defender Firewall console, Command Prompt, or PowerShell, you can only export and import all the rules, not a specific rule.

However, if you need to import a single rule on multiple computers without overwriting the current configuration, you can create a custom export file using the Registry and Notepad.

In this guide, you’ll learn the steps to export a specific rule that you can then import on the same or other devices.

How to export single firewall rule on Windows 10

If you want to export a single firewall rule, you’ll need to export all the rules, and then modify the list to include only the rules you want to import using the Registry and Notepad.

Exporting firewall rules using Registry

To export firewall rules with the Registry, use these steps:

Warning: It’s very important to note that modifying the Windows Registry can cause serious problems if not used properly. It’s assumed you know what you’re doing and that you have created a full backup of your system before proceeding.
  1. Open Start.

  2. Search for regedit and click the top result to open the Registry.

  3. Browse the following path:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy
  4. Right-click the FirewallRules key and select the Export option.

    Registry export FirewallRules
    Registry export FirewallRules
  5. Type a name of the .reg file — for example, firewall-export-date.reg.

    Registry save reg file on Windows 10
    Registry save reg file on Windows 10
  6. Click the Save button.

Once you complete the steps, you’ll need to open the exported file with Notepad to remove the entries that you don’t need or create a new .reg file containing only the entries you want to import.

Creating firewall export with one rule

To create export a single firewall rule, use these steps:

  1. Open File Explorer.

  2. Navigate to the folder that you exported the FirewallRules key.

  3. Right-click the file, select the Open with menu, and choose the Notepad app.

    File Explorer context menu Open with option
    File Explorer context menu Open with option
  4. Select the first three lines:

  5. Right-click the selection and click the Copy option.

    Notepad copy text to clipboard
    Notepad copy text to clipboard
  6. Open Start.

  7. Search for Notepad and click the top result to open the app.

  8. Right-click and select the Paste option.

    Notepad paste text
    Notepad paste text
  9. Go back to the file containing the FirewallRules key.

  10. Carefully select the line containing the firewall rules that you wanted to export and click the Copy option.

    Registry file exporting single firewall rule
    Registry file exporting single firewall rule
  11. Go back to the new Notepad files containing the three lines you pasted earlier.

  12. Position the typing cursor below the third line.

  13. Right-click and select the Paste option.

    Registry file exporting single firewall rule
    Registry file exporting single firewall rule
  14. Repeat steps No. 10 through 13 if you want to export multiple firewall rules.

  15. Click the File menu.

  16. Click the Save as option.

  17. Select a descriptive file name for the export — for example, firewall-app-name-rule.reg.

  18. Click the Save button.

After you complete the steps, you’ll end up with an export file that contains only the firewall rules that you want to export.

How to import single firewall rule on Windows 10

To import a single firewall rule on Windows 10, use these steps:

  1. Open File Explorer.

  2. Navigate to the modified .reg file containing the firewall that you want to import.

  3. Double-click the .reg file.

  4. Click the Yes button to confirm.

    Import single firewall rule on Windows 10
    Import single firewall rule on Windows 10
  5. Click the OK button.

Once you complete the steps, you can open the Windows Defender Firewall with Advanced Security console to confirm the rule has been added.

We’re focusing this guide on Windows 10, but these instructions should also work on Windows 8.1 and Windows 7.