Page 1 of 2 12 LastLast
  1.    05 Mar 2016 #1
    Join Date : Sep 2015
    Posts : 2,374
    Windows 10 Pro 64-bit 1706 (CU build 15063.674)

    How to block multiple EXE files Windows Firewall


    Hello!

    I want to block a certain application from any access to the internet, either inbound or outbound, so it will never attempt to upgrade. I went in the Advanced Settings in Windows Firewall but I can only block one-by-one the executable files (EXE) and this application has at least 30. Is there any way to block all EXE files in a specific folder at once?

    Thank you in advance.

    PS: This was asked in sevenforums.com by another poster and all replies were about blocking other users to share the folder. WRONG! I want to block all executables from accessing or receiving data from the internet, which is a totally different thing. So please reply only if you have something useful to say and keep it on topic. Thanks.
      My ComputerSystem Spec
  2.    05 Mar 2016 #2
    Join Date : May 2015
    Central IL
    Posts : 4,357
    Mac OS Sierra

    The problem is that without telling anyone what programs you are looking at restricting, there is not much that can be done. You do not block the programs from connecting outside of the LAN. You are blocking the ports that they use. It has always been that way. Blocking folders has nothing to do with this, so really do not even know why you brought it up, along with mentioning the other forum and getting upset about something by capitalizing your anger at something that has nothing to do with what you want to do.

    Windows Firewall rules are something that you can cause other issues if you do not create them right. Technet at microsoft.com has all of the information that you need to create firewall rules for the built in firewall.
      My ComputerSystem Spec
  3.    05 Mar 2016 #3
    Join Date : Feb 2014
    Posts : 487

    Windows Firewall doesn't support wildcards, therefore I'm thinking using a batch file would probably be the quickest way. Batch files aren't really my forte, however as an example maybe something along these lines.

    1) Paste ALL the following into NotePad (including the last line that's hidden from view) and obviously edit to show the folder path where the applications that you want to block are.

    Code:
    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
    
    )

    2) Save the text file and rename it to BlockInOut.bat

    3) Right-click BlockInOut.bat and run as administrator.

    Click image for larger version. 

Name:	001.jpg 
Views:	5 
Size:	48.6 KB 
ID:	67893


    4) Check your Inbound and Outbound firewall rules afterwards

    Click image for larger version. 

Name:	002.jpg 
Views:	11 
Size:	275.9 KB 
ID:	67894


    Note: Before carrying out any of the above, I'd recommend that you open Windows Firewall With Advanced Settings in the advanced view. Right-Click and select 'Export Policy', then save it somewhere safe. This way in the event of any problems, you'll be able to import your policy again to reset it back to how it is currently.

    Click image for larger version. 

Name:	003.jpg 
Views:	25 
Size:	114.5 KB 
ID:	67895


    Obviously be aware that Windows Firewall won't give you/the user any indication if or when it's blocking connections, unless you specifically set up Blocked Connection logging in Event Viewer.
      My ComputerSystem Spec
  4.    06 Mar 2016 #4
    Join Date : Jul 2014
    San Jose, California
    Posts : 2,206
    Ubuntu14.04x64 MintMate17x64 Win10Prox64

    In addition to the above. You can also try:
    Download TinyWall
    OR:
    Windows Firewall Control
      My ComputerSystem Spec
  5.    06 Mar 2016 #5
    Join Date : Sep 2015
    Posts : 2,374
    Windows 10 Pro 64-bit 1706 (CU build 15063.674)
    Thread Starter

    Quote Originally Posted by ARC1020 View Post
    Windows Firewall doesn't support wildcards, therefore I'm thinking using a batch file would probably be the quickest way. Batch files aren't really my forte, however as an example maybe something along these lines.

    1) Paste ALL the following into NotePad (including the last line that's hidden from view) and obviously edit to show the folder path where the applications that you want to block are.

    Code:
    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
    
    )

    2) Save the text file and rename it to BlockInOut.bat

    3) Right-click BlockInOut.bat and run as administrator.

    Click image for larger version. 

Name:	001.jpg 
Views:	5 
Size:	48.6 KB 
ID:	67893


    4) Check your Inbound and Outbound firewall rules afterwards

    Click image for larger version. 

Name:	002.jpg 
Views:	11 
Size:	275.9 KB 
ID:	67894


    Note: Before carrying out any of the above, I'd recommend that you open Windows Firewall With Advanced Settings in the advanced view. Right-Click and select 'Export Policy', then save it somewhere safe. This way in the event of any problems, you'll be able to import your policy again to reset it back to how it is currently.

    Click image for larger version. 

Name:	003.jpg 
Views:	25 
Size:	114.5 KB 
ID:	67895


    Obviously be aware that Windows Firewall won't give you/the user any indication if or when it's blocking connections, unless you specifically set up Blocked Connection logging in Event Viewer.
    Exactly the reply I was looking for! The script did the job in seconds! All I had to do was copy-paste the folder path from Windows explorer and modify the script. Million Thanks!

    Another guy mentioned blocking the ports. This is not the case, since the same ports could be used by another application and I don't know which ports I should block.

    Also it shouldn't cause any damage to block a specific application from accessing the internet, unless the application works by accessing the internet and other applications depend on it. So it is irrelevant which was the application I wanted to block. The script is the same, just use the proper path. Thanks again!

      My ComputerSystem Spec
  6.    06 Mar 2016 #6
    Join Date : Sep 2015
    Posts : 2,374
    Windows 10 Pro 64-bit 1706 (CU build 15063.674)
    Thread Starter

    Quote Originally Posted by topgundcp View Post
    In addition to the above. You can also try:
    Download TinyWall
    OR:
    Windows Firewall Control
    I downloaded Windows Firewall Control, but haven't tried yet since the script by ARC1020 did the job. Thank you any way! I added that in my Utilities collection.
      My ComputerSystem Spec
  7.    06 Mar 2016 #7
    Join Date : Jul 2014
    San Jose, California
    Posts : 2,206
    Ubuntu14.04x64 MintMate17x64 Win10Prox64

    Quote Originally Posted by spapakons View Post
    I downloaded Windows Firewall Control, but haven't tried yet since the script by ARC1020 did the job. Thank you any way! I added that in my Utilities collection.
    Glad it works out for you. However, Try WFC, you might find it useful as it does what the script does and a lot more.
    In some case, blocking the .exe is not enough, you also need to block the .dll also.
      My ComputerSystem Spec
  8.    09 Dec 2016 #8
    Join Date : Dec 2016
    Posts : 1
    Windows 10 Pro

    Quote Originally Posted by bro67 View Post
    The problem is that without telling anyone what programs you are looking at restricting, there is not much that can be done. You do not block the programs from connecting outside of the LAN. You are blocking the ports that they use. It has always been that way. Blocking folders has nothing to do with this, so really do not even know why you brought it up, along with mentioning the other forum and getting upset about something by capitalizing your anger at something that has nothing to do with what you want to do.Windows Firewall rules are something that you can cause other issues if you do not create them right. Technet at microsoft.com has all of the information that you need to create firewall rules for the built in firewall.

    Old thread, but I gotta add -- the above is just plain incorrect. Windows firewall does indeed have the capability of blocking an application from accessing the internet regardless of the ports it use. It's always been that way.
      My ComputerSystem Spec
  9.    10 Dec 2016 #9
    Join Date : Sep 2015
    Posts : 2,374
    Windows 10 Pro 64-bit 1706 (CU build 15063.674)
    Thread Starter

    Yes doesn't matters which port the application tries to use, you can block it for any port and any protocol (UDP or TCP) to make sure. If you don't know which of many EXE the application launches to connect to the internet, you just block the whole folder (see earlier posts in this thread) so there is no way it can access the internet without you explicitly giving permission. This is to avoid auto updates that can screw the application and cannot be turned off by the user. You cannot turn it off, so you block it and you have a peace of mind. However be careful not to block an application that relies on internet access to work or you effectively disable it.
      My ComputerSystem Spec
  10.    27 Feb 2017 #10

    Use this batch file to add exe and dll files to Firewall in Windows 10 - it works perfectly.

    GitHub - charlesdh/addfwrs: addfwrs - created by Charles de Havilland
      My ComputerSystem Spec

 
Page 1 of 2 12 LastLast


Similar Threads
Thread Forum
Batch File - Find Multiple Files From Multiple Locations
Hi, I'm not new to Batch Files but i have a requirement that i can't seem to get my head around, I'm sure it must be simple'ish.. I have 2 .txt files (Locations.txt | Files.txt) Locations is a list of directories Files is a list of...
General Support
right click on multiple files sometime appear windows defender why?
hi i have noticed that when i select multiple files or folder sometime appears analyzes with windows defender my antivirus is eset smart security 9 ,that include antivirus , firewall and hips windows defender is disabled the strange thing...
General Support
How to block downloading upgrade to Windows 10?
Hi, I do not know if this is the appropriate forum but really I need help. I have Windows 8.1 and I can not install the updates to Windows 8.1 in Windows Update because it always starts downloading Windows 10. How to block downloading Windows 10 and...
Windows Updates and Activation
Block Windows Update downloading on WIn 10 Home?
I can't have my notebook (upgraded from Win 7 Home) using bandwidth to download from Windows Update when I'm away from home. It seems I must either (a) mark every wifi connection as metered, or (b) mark the startup setting for the WAU service as...
Windows Updates and Activation
User Accounts Allow or Block Family Member using a PC in Windows 10
It’s easy to share your Windows 10 PC with family members. Add family members using Add a family member from your PC's Settings, and they’ll be able to use that PC as well. And you're always in control. You can allow or block them from using a PC at...
Tutorials
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:07.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums