πŸš€ Experience the new and improved APIVoid! Check out what's new

Windows Firewall Rule Builder

Build Windows Firewall rules online with this firewall rule builder. Generate batch scripts to block programs by file path, direction, profile, protocol, and rule group, making it easy to manage and remove rules later. Other useful tools include Curl Command Builder, Cron Expression Generator and Website Uptime Check.

WINDOWS FIREWALL TIPS

Common Windows Firewall questions

Find clear answers to common Windows Firewall questions, covering the generation of block rules, rule removal, and rule verification.

How do I use this Windows Firewall Rule Builder?

To use the Windows Firewall Rule Builder, start by entering one or more full executable file paths in the "Full file paths" field, placing each path on a separate line. These paths represent the applications you want to block. Next, choose the desired direction (inbound or outbound), network profile (any, public, private, or domain), and protocol (any, TCP, or UDP). You can also specify a rule group name (by default is "Auto-Generated Rules"), which is required and helps you manage or remove the generated rules later.

As you change any option, the tool automatically generates a ready-to-run batch script (.bat) in the below textarea. Each firewall rule is created with an automatically generated name in the format:

Here is an example auto-generated rule name for Notepad++ executable file:

This will make it easy to identify the rules inside Windows Firewall. Now, to apply all the firewall rules, simply copy or export this script and run it as an administrator on Windows.

How to block outbound connections of a program?

With cmd.exe, run it as Administrator, then:

This blocks all outbound traffic from the specified executable on all profiles.

With PowerShell, run it as Administrator, then:

How to block a specific outbound remote port for a program?

With cmd.exe, run it as Administrator, then:

This blocks outbound TCP connections to the specified remote port for the selected program.

With PowerShell, run it as Administrator, then:

How to block inbound connections of a program?

With cmd.exe, run it as Administrator, then:

This blocks all inbound traffic from the specified executable on all profiles.

With PowerShell, run it as Administrator, then:

What are the available values for direction parameter?

With cmd.exe, the dir parameter can have one of the following values:

  • dir=in – applies to inbound connections (traffic coming into the system)
  • dir=out – applies to outbound connections (traffic leaving the system)

With PowerShell, the Direction parameter can have one of the following values:

  • Direction Inbound – inbound connections
  • Direction Outbound – outbound connections

What are the available values for profile parameter?

With cmd.exe, the profile parameter can have one of the following values:

  • profile=domain – applies when connected to a domain network
  • profile=private – applies when connected to a private network
  • profile=public – applies when connected to a public network
  • profile=any – applies to all network profiles

If the profile parameter is omitted, it defaults to any.

With PowerShell, the Profile parameter can have one or more of the following values:

  • Profile Domain – domain network
  • Profile Private – private network
  • Profile Public – public network
  • Profile Any – all network profiles

If the profile parameter is omitted, it defaults to Any.

What are the available values for protocol parameter?

With cmd.exe, the protocol parameter can have one of the following values:

  • protocol=tcp – applies to TCP traffic
  • protocol=udp – applies to UDP traffic
  • protocol=icmpv4 – applies to ICMP for IPv4 (for example, ping)
  • protocol=icmpv6 – applies to ICMP for IPv6
  • protocol=any – applies to all protocols

If the protocol parameter is omitted, it defaults to any.

With PowerShell, the Protocol parameter can have one of the following values:

  • Protocol TCP – TCP traffic
  • Protocol UDP – UDP traffic
  • Protocol ICMPv4 – ICMP for IPv4
  • Protocol ICMPv6 – ICMP for IPv6
  • Protocol Any – all protocols

If the protocol parameter is omitted, it defaults to Any.

Where are Windows Firewall rules stored in the Registry?

Windows Firewall rules are stored in the Windows Registry, under the following key:

You can paste this directly into regedit.exe and press Enter.

Each firewall rule is stored as a registry value inside the FirewallRules key.

Firewall rules are stored in a binary-encoded format, not plain text.

How to verify if a Windows Firewall rule exists?

With cmd.exe, run it as Administrator, then:

If the rule exists, Windows will display all its details (direction, program path, action).

If not, you’ll see: "No rules match the specified criteria.".

With PowerShell, run it as Administrator, then:

How to delete a Windows Firewall rule by rule name?

With cmd.exe, run it as Administrator, then:

If the rule exists, it will be removed immediately.

⚠️ If multiple rules share the same name, all matching rules will be deleted.

With PowerShell, run it as Administrator, then:

How to create a Windows Firewall rule with a group name?

With cmd.exe, run it as Administrator, then:

The group parameter is used to assign the rule to a group.

With PowerShell, run it as Administrator, then:

The Group parameter is used to assign the rule to a group.

How to delete all Windows Firewall rules in a group name?

With cmd.exe, run it as Administrator, then:

All rules assigned to that group will be removed, without confirmation.

With PowerShell, run it as Administrator, then:

How to export all Windows Firewall rules to a file?

With cmd.exe, run it as Administrator, then:

This exports all Windows Firewall settings and rules to the specified .wfw file.

With PowerShell, run it as Administrator, then:

How to restore all Windows Firewall rules from a file?

With cmd.exe, run it as Administrator, then:

⚠️ Importing a .wfw file replaces the current firewall configuration.

Always back up the existing rules before importing.

With PowerShell, run it as Administrator, then:

Start using our API services, it takes just a few minutes

Create your account, pick a subscription plan, and make your first API call instantly with your API keyβ€”simple as that!

Get started now