How to block a program or an entire folder in Windows Firewall
To block a program in Windows Firewall, create an outbound rule that points to the program's .exe file and set the action to "Block the connection". Windows Firewall does not accept folders or wildcards in program rules, so blocking an entire folder means creating one rule per executable: by hand, with a short PowerShell loop, or with a free tool such as Folder Firewall Blocker.
This guide covers all three methods, explains why block rules always win over allow rules, and shows how to check and undo a firewall block on Windows 10 and Windows 11.
How does a firewall block work in Windows?
A firewall block in Windows is a rule that tells Windows Defender Firewall to drop network traffic that matches it, for example all traffic sent or received by one program. Microsoft's firewall handles the two directions differently, which matters when you want to cut a program off from the internet:
- Inbound: blocked by default. Traffic only gets in if an allow rule exists, which is why programs ask for permission the first time they listen for connections.
- Outbound: allowed by default. A program can connect to the internet unless a rule prohibits it, so stopping an app from "phoning home" needs an explicit outbound block rule.
- Precedence: according to Microsoft's firewall rules documentation, explicit block rules take precedence over any conflicting allow rules, and rules cannot be reordered by hand.
The important limitation: application rules use the full path of a single file. Microsoft states that wildcard patterns such as C:\*\app.exe are not supported in application rules. There is no "block this folder" checkbox, and that is the gap the methods below fill.
How to block a program in Windows Firewall
The built-in way to block one program is an outbound rule in Windows Defender Firewall with Advanced Security. You need administrator rights. The steps follow Microsoft's configuration guide:
- Press Windows-R, type wf.msc and press Enter.
- Select Outbound Rules in the left pane, then Action > New Rule.
- Choose Custom as the rule type and click Next.
- On the Program page, select This program path and browse to the program's .exe file.
- Leave Protocols and Ports and Scope at their defaults to block all traffic, and click Next.
- On the Action page, select Block the connection.
- Pick the profiles (Domain, Private, Public); leave all three checked to block the program everywhere.
- Give the rule a descriptive name, for example "Block Example app outbound", and click Finish.
Repeat the process under Inbound Rules if you also want to stop the program from accepting incoming connections. The rule takes effect immediately; there is no need to restart the program or Windows.
How to block an entire folder in Windows Firewall with PowerShell
PowerShell is the fastest built-in way to block every executable in a folder, because it can create one rule per file in a single command. The New-NetFirewallRule cmdlet takes the full path of one program per rule, so the command loops through the folder and passes each file to it. Open Windows Terminal or PowerShell as administrator and run (replace the path with your folder):
- Set the folder:
$folder = "C:\Tools\ExampleApp" - Create outbound block rules for every .exe, including subfolders:
Get-ChildItem $folder -Recurse -Filter *.exe | ForEach-Object { New-NetFirewallRule -DisplayName "Folder block: $($_.Name)" -Direction Outbound -Program $_.FullName -Action Block } - Run the same command with
-Direction Inboundif you want to block incoming connections too.
Every rule starts with "Folder block:", which makes them easy to find and remove later. The rules cover the files that exist when you run the command. An executable added to the folder later is not blocked until you run the loop again, and a rule stops matching if its file is moved or renamed, because rules are tied to the exact path.
Folder Firewall Blocker: block a folder with one click
Folder Firewall Blocker is a free, open source Windows program that creates Windows Firewall block rules for all executable files in a folder you select. Launch it, click Folder to pick a local folder, and click Block.

A confirmation prompt appears before the program writes any rules. Click Yes to add the rules to Windows Firewall, or No to cancel.

Version 1.2.1, the latest release listed by MajorGeeks, can include subfolders and covers many executable types beyond .exe, including com, bat, cmd, vbs, js, wsf, msi, scr, cpl, dll and sys files. An extra file types tab lets you add your own extensions.

Keep its limits in mind. The program dates from 2016 and has not been updated since; MajorGeeks lists support up to Windows 10. It also shares the PowerShell method's main weakness: it does not watch the folder, so files added later stay unblocked until you run it again. For a maintained alternative with a graphical interface, Sordum's Firewall App Blocker supports Windows 11 and includes a whitelist mode that blocks everything except the programs you allow.
Which method should you use?
The right method depends on how many files you need to block and whether you want to stay with built-in tools:
| Method | Best for | Limitation |
|---|---|---|
| wf.msc outbound rule | One or two programs | One rule per file, created by hand |
| PowerShell loop | Whole folders on Windows 10 and 11, no extra software | New files need a re-run |
| Folder Firewall Blocker | Point-and-click folder blocking, many file types | Unmaintained since 2016 |
| Firewall App Blocker | Managing many app rules, whitelist mode | Third-party tool, Windows Firewall must be on |
If a program keeps connecting despite a block, check that it is not running a helper executable from another folder (updaters often live elsewhere), and use a monitor such as Windows Firewall Notifier to see which process makes the connection.
How to check and remove a firewall block
You can review or undo any firewall block in the same console that created it. In wf.msc, open Outbound Rules (or Inbound Rules); blocked entries show a red circle icon. Right-click a rule and choose Disable Rule to pause it or Delete to remove it.
For rules created with the PowerShell loop, one command in an elevated PowerShell window removes them all at once: Remove-NetFirewallRule -DisplayName "Folder block:*". To list them first without deleting anything, run Get-NetFirewallRule -DisplayName "Folder block:*".
Windows Security offers a simpler view under Firewall & network protection > Allow an app through firewall, but that list manages allow entries. A block rule overrides an allowed app, so remove the block rule itself when a program should go online again.
FAQ
Does a firewall block stop a program from updating itself?
Only if the update runs through the blocked executable. Many programs use a separate updater file, so you need a rule for that file as well, or the program can still update itself.
Can I block all internet access except a few programs?
Yes. Set the outbound default to block in the firewall profile properties of wf.msc and create allow rules for the programs you want online. This whitelist approach blocks new programs automatically but needs more maintenance.
Do firewall block rules survive a restart?
Yes. Rules created in wf.msc, with PowerShell or with tools that write Windows Firewall rules are stored by Windows and stay active after a restart until you disable or delete them.
Related: Windows Update Blocker disables updates with one click, Security Task Manager review, enable the hidden Windows 11 administrator account
Worked fine! Very usefull.
It the project dead? There are no files on its SourceForge page. Too bad. I needed this to run Chinese programs.
@Murderer Nitesh, latest ‘Folder Firewall Blocke’r version (as far as i know) which is 1.2.1 is still available at Softpedia [https://www.softpedia.com/get/Security/Security-Related/Folder-Firewall-Blocker.shtml]
what happened to ffb links? please check.
hi
when add special type files like ini cfg pak bin etc nex time the list restore to default no custom type files i hope you fix it to save added files type next time they are there thankyou ^^
worked perfectly.. Thanks for the recommendation..
@yunggoose
Ran Folder Firewall Blocker 1.2.1.0 multiple times on Windows 10.
The program correctly finds the .exe, .dll, &c. files in the folder & subfolders and announces success.
Yet no new firewall rules are ever generated, as a subsequent check shows.
What can I try to make it work? Thanks.
Jar
Hi Martin,
You did mention
“While you may be able to work around the second and third issue, there is nothing that you can do about the first”
Although i had never used this program, but i think first point could also have workaround like ‘test.txt’ in windows can be changed to ‘test.exe’
thanks for the tip!
together with this .bat file, they will ease the pain of using Windows Firewall…
https://gist.github.com/awurts/9774751
Already block all outgoing traffic by default using Sphinx Windows Firewall Control. It prompts and shows a notification for when some apps wants to connect. You just click Allow as required.
I’m currently patching FFB to block:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
If there are any I am missing in this list, tell me and I will add them!
Missing .dat. I already see .dat using internet
.SCR, .MSI, .CPL, .OCX, perhaps even .DLL, .DRV, and .SYS
Done 1.1.0 is live. :)
TinyWall is the best.
I don’t understand why you review “Folder Firewall Blocker” if it really has those shortcomings as you listed. It’s totally useless.. and even dangerous if the user doesn’t understand the shortcomings.
I have tiny wall and it WILL NOT allow me to block Adobe programs period. Also, the above program didn’t block the Adobe folder whatsoever. Each instance was shown hitting tinywall and swiftly establishing connections it shouldn’t have.