How to Add Multiple Programs to Windows Firewall at Once

Written by

in

Adding programs to the Windows Defender Firewall one by one is tedious. Fortunately, you can batch-import multiple applications simultaneously using built-in automation tools.

Here is how to allow multiple programs through your firewall at once using Command Prompt and PowerShell. Method 1: Use Command Prompt (Fastest for Folders)

If all the programs you want to add are located in the same folder, you can use a simple Command Prompt loop to add them all in seconds.

Click the Start menu, type cmd, right-click Command Prompt, and select Run as administrator.

Copy the path to the folder containing your program executables (e.g., C:\Games).

Type the following command, replacing C:\YourFolderPath with your actual path:

for %i in (“C:\YourFolderPath*.exe”) do netsh advfirewall firewall add rule name=“Allowed_%~ni” dir=in action=allow program=“%i” enable=yes Use code with caution. Press Enter.

Windows will automatically scan the folder and create an inbound rule for every .exe file it finds. Method 2: Use PowerShell (Best for Specific Lists)

If your programs are scattered across different folders, you can use PowerShell to target a specific list of file paths.

Right-click the Start button and select Terminal (Admin) or PowerShell (Admin).

Prepare a list of the exact paths to your programs, separated by commas.

Paste the following script into the PowerShell window, updating the paths inside the brackets: powershell

\(apps = @( "C:\Program Files\App1\app1.exe", "C:\Program Files\App2\app2.exe", "D:\Tools\tool3.exe" ) foreach (\)app in \(apps) { \)name = Split-Path \(app -Leaf New-NetFirewallRule -DisplayName "Allow \)name” -Direction Inbound -Program $app -Action Allow } Use code with caution. Press Enter to execute the script.

PowerShell will loop through your list and create distinct, labeled firewall rules for each application. How to Verify the Changes To ensure your programs were added correctly:

Press Win + R, type wf.msc, and press Enter to open Windows Defender Firewall with Advanced Security. Click on Inbound Rules in the left sidebar.

Look for the names created by your script (e.g., “Allowed_AppName” or “Allow app1.exe”). Safety Tip: Outbound Rules

The methods above create Inbound Rules, which allow external traffic to reach your apps. If your programs also require unrestricted access to send data out to the internet, simply run the commands a second time, changing dir=in to dir=out in Command Prompt, or -Direction Inbound to -Direction Outbound in PowerShell. If you want to customize this further, let me know:

Do these apps need outbound communication block or allowance?

Are you deploying this across multiple network profiles (Public, Private, or Domain)?

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *