Windows Firewall, a crucial component of the Windows operating system, plays a vital role in safeguarding your computer from malicious software and unauthorized network access. While the graphical user interface (GUI) provides an easy way to manage firewall rules, sometimes you might need to delve into the command line for more advanced operations. This article will guide you through listing, understanding, and managing Windows Firewall rules using the command line.

Before we dive into the commands, ensure you have administrative privileges on your Windows machine. Many firewall operations require elevated permissions. Also, it's essential to understand that these commands are case-sensitive and should be executed in the Command Prompt or PowerShell.

Listing Windows Firewall Rules
To list all the rules in the Windows Firewall, you can use the following command in the Command Prompt:

netsh advfirewall firewall show rule name=all
This command will display a list of all rules along with their names, groups, enabled status, and other relevant details. However, the output can be quite extensive, making it difficult to parse through. To make it more manageable, you can redirect the output to a text file:

netsh advfirewall firewall show rule name=all > firewall_rules.txt
Filtering Rules by Name
If you're looking for a specific rule, you can filter the output by name using the following command:

netsh advfirewall firewall show rule name="rule_name"
Replace rule_name with the name of the rule you're looking for. This command will display detailed information about the specified rule.
Filtering Rules by Group

You can also filter rules by their group using the following command:
netsh advfirewall firewall show rule group="group_name"









![15+ Best CMD Tricks And Hacks (Command Prompt) 2025 - [Top List] - Safe Tricks](https://i.pinimg.com/originals/78/1c/99/781c9944a16c8f86ba7cd324116679c3.jpg)










Replace group_name with the name of the group you want to filter. This command will list all rules belonging to the specified group.
Understanding Windows Firewall Rule Properties
Each rule in the Windows Firewall has several properties that determine its behavior. You can list these properties using the following command:
netsh advfirewall firewall show rule name="rule_name" all
This command will display all the properties of the specified rule, including its name, group, action, direction, protocol, and local ports.
Enabling and Disabling Rules
To enable or disable a rule, you can use the following commands:
netsh advfirewall firewall set rule name="rule_name" new enable=yes
To disable a rule, replace yes with no:
netsh advfirewall firewall set rule name="rule_name" new enable=no
Deleting Rules
To delete a rule, you can use the following command:
netsh advfirewall firewall delete rule name="rule_name"
Managing Windows Firewall Profiles
Windows Firewall has three profiles: Domain, Private, and Public. Each profile can have its own set of rules. To list all rules for a specific profile, use the following command:
netsh advfirewall firewall show rule profile=profile_name
Replace profile_name with the name of the profile you want to list (Domain, Private, or Public).
Switching Profiles
To switch between profiles, you can use the following command:
netsh advfirewall set currentprofile profile_name
Replace profile_name with the name of the profile you want to switch to.
In conclusion, understanding and managing Windows Firewall rules using the command line can be a powerful tool for system administrators and power users. Whether you're looking to list, enable, disable, or delete rules, the commands outlined in this article provide a comprehensive guide to help you achieve your goals. Always remember to exercise caution when modifying firewall rules to ensure the security of your system.