- How to Block Multiple Files in a Windows Firewall
- Block and unblock .exe files from the firewall using a batch file
- FIX: Windows 10 Firewall is blocking File Sharing
- How can I unblock File Sharing on Windows 10?
- 1. Enable File and Printer Sharing
- 2. Allow File and Printer Sharing to communicate through Firewall
- Block or Unblock Programs in Windows Defender Firewall
- You Might Also Like
- Reader Interactions
- Comments
- Did this help? Let us know! Cancel reply
- Primary Sidebar
- Recent Posts
- Who’s Behind Technipages?
- Как заблокировать несколько файлов в Брандмауэре Windows?
- Блокировка нескольких .exe-файлов с помощью BAT-файла
How to Block Multiple Files in a Windows Firewall
A firewall is software or hardware that checks information coming from the Internet or a network, and then either blocks it or allows it to pass through to your computer, depending on your firewall settings. A firewall can help prevent hackers or malicious software (such as worms) from gaining access to your computer through a network or the Internet. A firewall can also help stop your computer from sending malicious software to other computers.
The same thing occurs in Windows Firewall. Some applications need to connect to the internet from time to time. However, the firewall has control over which .exe and .dll files on your PC can connect to the network be it a domain network, a public network or a private network. By default, all application .exe and .dll files are blocked on the firewall. If an .exe file is not allowed on Windows firewall, it will not be able to communicate over the network. This includes games that you can play over the internet or over a network connection. To set your windows firewall preferences, you can: Press Windows Key + R, type firewall.cpl and hit enter then on the window that appears click on “allow a program or feature through Windows firewall.” Here, you can change which programs are allowed, and add new executable files.
However, when you need to block or unblock more than one .exe file, and more so, on more than one PC (or if you are developing an app that needs firewall permission), then you will find the repetitive work energy-zapping. In this article we are going to show you how to block and unblock multiple .exe files that are in the same folder. For our demonstration purposes, we are going to assume the program files folder to be our target folder.
You are advised to first take a backup of your current Windows Firewall policy incase anything goes wrong. To do this: Press Windows Key + R to open run, type wf.msc and hit enter to open ‘Windows Firewall with Advanced Security.’ On the far right panel, click on ‘Export Policy’ and save the file. If anything goes wrong, you can import this policy.
Block and unblock .exe files from the firewall using a batch file
Through netsh (a scripting tool that allows command line prompts to modify the network settings), you can use command line prompts to change the settings on your firewall, thus allowing you to block or unblock .exe or .dll files. Since the firewall dictates incoming and outgoing connections, we have to disable both the in and out directions for our files. To do this:
- Open notepad and copy the scrip below. Save it as a .bat extension file.
- This is the basic script version of changing your firewall settings: You can set your target folder accordingly. Replace the path “C:\Program Files (x86)\Test Folder\” with the path where the exe files are.for %%G in (“C:\Program Files (x86)\Test Folder\*.exe”) do (netsh advfirewall firewall add rule name=”Blocked With Batchfile %%G” dir=in action=block program=”%%G” enable=yes profile=any
netsh advfirewall firewall add rule name=”Blocked With Batchfile %%G” dir=out action=block program=”%%G” enable=yes profile=any
)
- You can also download this advanced script, which can search for exe files and add them to the Firewall block list. Place the downloaded file in the folder (source) from where the exe files should be scanned and blocked.
- Right click on the script and click ‘Run as administrator’ or open command prompt as administrator, browse to the folder where the file is located, and execute it by typing exeblocker.bat
- Your exe files will be blocked on Windows firewall. You can check this by going to the ‘Windows Firewall with advanced security’ window: Press and hold Windows Key + R, type wf.msc and hit enter.
- To allow exe files through Windows Firewall, just find the phrase action=block in the script and replace it with action=allow.
- To allow/block .dll files through Windows Firewall, just find the phrase *.exe in the script and replace it with *.dll
You might also want to explore the options of a third party application to add .exe and .dll files; this includes Windows Firewall Controller downloadable from here or TinyWall available here.
FIX: Windows 10 Firewall is blocking File Sharing
- Having your Windows 10 Firewall block your PCs File Sharing capabilities can get very annoying.
- To resolve this issue, you should start by making sure that File and Printer Sharing is enabled.
- Don’t hesitate to explore our thorough Troubleshooting Hub for more easy-to-follow guides on this topic.
- Our detailed Windows 10 section can offer you quick access to some other useful guides, so make sure to explore it further.
File Sharing is an essential feature for users who have multiple PCs in a Homegroup (Workgroup). Once it’s configured, the file exchange should work seamlessly.
After enabling File Sharing, your Windows Defender Firewall should allow the feature to communicate freely.
However, some users reported issues with Windows 10 Firewall blocking File Sharing.
We have a few solutions to suggest below, so make sure to check them out.
How can I unblock File Sharing on Windows 10?
1. Enable File and Printer Sharing
- In the Windows Search bar, type Sharing and open Manage advanced sharing settings.
- Under the Network discovery, toggle the Turn on network discovery on.
- Under the File and printer sharing, toggle the Turn on file and printer sharing on.
- Save changes and reboot your PC.
2. Allow File and Printer Sharing to communicate through Firewall
- In the Windows Search bar, type Firewall and open Windows Defender Firewall.
- Open the Allow an app or feature through Windows Defender Firewall.
- Click Change settings.
- Navigate to File and Printer Sharing and File and Printer Sharing over SMBDirect.
- Make sure to check both Private and Public boxes next to these entries.
- Save changes and try sharing files on the local network again.
We hope that this guide has managed to solve your problem once and for all.
If you want to share your experience with us or have any suggestions, feel free to contact us by using the comment section found below this article.
Block or Unblock Programs in Windows Defender Firewall
By Mitch Bartlett 15 Comments
In Microsoft Windows 10 you can set the Windows Defender Firewall to block or unblock certain applications. Here’s how.
- Select the “Start” button, then type “firewall“.
- Select the “Windows Defender Firewall” option.
- Choose the “Allow an app or feature through Windows Defender Firewall” option in the left pane.
- Unchecking the box to the left of the application name disallows it from accessing network resources, while checking it allows access. You can also check the boxes to the right of the name labeled “Private” or “Public” to allow and disallow the app on private or public networks respectively.
- If the program you wish to block or unblock is not listed, you can click the “Allow another app…” button to add it. Choose the application in the list and select “Add“. If the program is not in this list, use the “Browse…” button to select the program file manually.
You Might Also Like
Filed Under: Windows Tagged With: Windows 10
Reader Interactions
Comments
Susan Olson says
No…I am definitely not a pro…so a little more explanation would be great…say, what about gallery or settings….?
Susan Olon says
Could you give me an example as to what applications should NOT cross the firewall??
Any application can block any crack microsoft office .. can you help me how to block any crack microsoft on my laptop ..
Richard Jordan says
The firewall is blocking access to open areas of the United Nations website. Even public press releases. How do I uninstall Micrsoft Edge, if that is what is blocking me.
So, what’s the meaning of a checked box and an unchecked box?
I am trying to allow zoom to have access but firewall is blocking it.
I’m trying to block Microsoft family features so it won’t send me the annoying pop-ups about signing in.
I’m on the correct thing but I can’t uncheck the box beside it. If I click the box it does nothing,
Do we have any registry settings for the same.
Thanks, it worked
What if when you click “Allow another app” and then Choose the app in the directory and it gives an error about a possible virus?
Josh Everett says
Is there any way to do this without Administrator rights?
Settings for some pro, doesn’t change!
its somehow locked, as if a registry rule is overriding this windows rules.
Richard S Nye says
I have been trying for hours to Block “Fortnite” from my PC windows 10
Edwin Wetzel says
nothing helps. i’ve been trying to hook up my wifi scanner and i’ve been doing this for hours without any success. i’ve followed all the different procedures on line including going into the defender advanced settings and allowing file and printer sharing rules and still does not work.
What if you cant click the “Allow the app or feature through windows defender firewall”?
Mike Bading says
Mitch,
First, I hope this note finds all well with you and yours.
Second, thank you for your effort here.
Third, my question(s):
What do you do when Windows Defender keeps resetting Microsoft Apps you have unchecked/deselected in Windows 10 Home or Windows 10 Pro?
Example: Let’s say I wish to block Cortana (or any other app). I then follow your instructions here and uncheck/deselect all the boxes pertaining to Cortana and then close the window.
Let’s say, that for whatever reason(s), I return to the window in your example only to find that Windows has reset/unblocked Cortana without notice and without my permission. This would happen all the time in Win10Home; and I would like to know if this would happen in Win10Pro and what to do about it if it does.
Respectfully,
Mike Bading
Did this help? Let us know! Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Primary Sidebar
Recent Posts
Who’s Behind Technipages?
My name is Mitch Bartlett. I’ve been working in technology for over 20 years in a wide range of tech jobs from Tech Support to Software Testing. I started this site as a technical guide for myself and it has grown into what I hope is a useful reference for all.
Follow me on Twitter, or visit my personal blog.
Как заблокировать несколько файлов в Брандмауэре Windows?
Фаервол – это программное обеспечение или аппаратное средство, которое выполняет проверку входящей информации из Интернета или сети, и либо блокирует ее, либо позволяет проходить через компьютер, в зависимости от настроек самого firewall.
Фаервол может помочь пользователям уберечься от нападения хакеров или от вредоносного программного обеспечения, которые могут получить доступ к вашему компьютеру через вашу сеть. Фаервол также может помочь остановить отправку вредоносных файлов с вашего компьютера на другие ПК.
Все вышеописанное также можно отнести и к Брандмауэру Windows. Некоторые приложения требуют для себя подключения к сети время от времени. Однако, у фаервола есть контроль над тем, какие .exe и .dll на вашем компьютере подключать к публичной, личной или доменным сетям.
По умолчанию, все приложения заблокированы Брандмауэром. Если какому-то приложению или программе запрещено связываться с сетью, то Брандмауэр блокирует ей доступ. В список этих программ также могут входить и ваши игры, для работы с которыми вам требуется Интернет-подключение.
Для того чтобы установить нужные вам настройки в Брандмауэре Windows, вы можете:
- Нажать одновременно кнопки Win+R.
- Затем вписать в строку утилиты «Выполнить» запрос firewall.cpl и нажать Enter.
- Выбрать «Разрешение взаимодействия с приложением или компонентом в брандмауэре Windows».
В этом окне вы сможете выдавать разрешения определенным программам или же добавлять новые исполнительные файлы.
Однако, когда вам нужно заблокировать или снять блокировку с более чем одного исполнительного файла на вашем компьютере(или если вы разрабатываете приложение, которому требуется разрешение firewall’а), то вам нужно проделывать достаточно много однообразной работы для этого.
Сейчас мы покажем вам, как блокировать несколько файлов одновременно или даже целые папки в Брандмауэре Windows. Для демонстрационных целей, мы будет показывать этот метод на папке Program Files.
Для начала вы рекомендуем вам сделать резервную копию вашей политики в Брандмауэре Windows, на случай того, если что-то пойдет не так. Для этого сделайте следующее:
- Нажмите комбинацию из Win+R, напишите wf.msc и нажмите Enter для открытия Брандмауэра Windows в режиме повышенной безопасности.
- В самом правом углу окна, нажмите на «Экспортировать политики…» и сохраните их в файл. Если что-то произойдет при выполнении нижеуказанных шагов, то вы сможете использовать этот Wfw-файл для восстановления состояний политик.
Блокировка нескольких .exe-файлов с помощью BAT-файла
Через netsh(скриптовый инструмент, которые позволяет Командной строке изменять настойки сетевого подключения), вы можете использовать силы Командной строки изменить настройки вашего Firewall’а. Так как Брандмауэр контролирует входящие и исходящие соединения, то вы должны отключить их обоих для ваших файлов. Для этого сделайте следующее:
- Откройте Блокнот и копируйте следующие строки в него:
for %%G in (“C:\Program Files (x86)\Test Folder\*.exe”) do (netsh advfirewall firewall add rule name=”Blocked With Batchfile %%G” dir=in action=block program=”%%G” enable=yes profile=anynetsh advfirewall firewall add rule name=”Blocked With Batchfile %%G” dir=out action=block program=”%%G” enable=yes profile=any)
dp0”
color F0
title Exe blocker
echo.
echo. ==============================
echo. == Welcome to .exe blocker ==
echo. ==============================
echo.
Echo Current location: %cd%
echo.
CHOICE /C YN /M “Do you want to search in the current location?”
IF Errorlevel 2 goto END
IF Errorlevel 1 goto Yes
::——————–CHECK and searching files—————–
:Yes
set location=%cd%
cls
echo.
Echo. Searching for .exe files in %location%
echo.
set /a count=0
echo.___________________________________________
echo.Found:
echo.
FOR %%i in (*.exe) do (echo. %%i & set /a count+=1)
echo.___________________________________________
echo.
title Exe blocker %count% Files found
echo. Number of files found with .exe extention: %count%
echo.
echo.
set add2=
CHOICE /C YN /M “Do you want to add aditional information?”
IF Errorlevel 2 goto block
IF Errorlevel 1 goto ADD
::—————–ADD additional info—————
:ADD
Set /p add=Please type the additonal information for the name:
Set add2=%add%
::—————–Add files to firewall————–
:block
cls
title Exe blocker – Blocking Rules
set /a countt=0
echo.
echo.___________________________________________
echo. Inbound Rules
echo.___________________________________________
FOR /r %%B in (*.exe) do (set /a countt+=1 & echo.%countt%. %%
nxB blocking… & netsh advfirewall firewall add rule name=”%add2%%%
nxB” dir=in action=block program=”%%
dpfnxB”)
echo.___________________________________________
echo. OutBound rules
set /a coun=0
echo.___________________________________________
FOR /r %%B in (*.exe) do (set /a coun+=1 & echo.%coun%. %%
nxB blocking… & netsh advfirewall firewall add rule name=”%add2%%%
nxB” dir=out action=block program=”%%
dpfnxB”)
echo.___________________________________________
Echo. Added files to Firewall
echo.
title Exe blocker – Rules Blocked
Pause
::————————END———————
:END
cls
ECHO.
Echo. Thanks for using .exe blocker
Echo.
CHOICE /C YN /T 10 /D n /M “Do you want to open firewall? (10 seconds)”
IF Errorlevel 2 goto EXIT
IF Errorlevel 1 goto OPEN
::——————Open Firewall—————
:OPEN
start “C:\Windows\System32” rundll32.exe shell32.dll,Control_RunDLL firewall.cpl
Goto EXIT
- Чтобы разрешить заблокированные файлы, просто замените значение action=block на значение action=allow.
- Чтобы разрешать или блокировать dll-файлы, найдите в скрипте *.exe и замените ее на *.dll.