Windows firewall works pretty well, but it's not easy to configure with multiple programs (time consuming).
 
I looked for ages to find a way of blocking multiple .exe files through Windows Firewall in one go; it seems the only possible method was to create my own batch file (windows script).  Which I did, an have added it below for anyone to use / modify for their own purposes.
 

The batch files below, will add inbound AND outbound firewall rules that block all .exe and .dll files within your chosen folder (and all subfolders) from accessing the internet - pretty useful.


Two versions -

v1  One Click version
If you want to just click a script in Windows that adds the firewall rulenames automatically, for just one app, choose this version.

        Install:
          Download auto_addfwrs.bat.txt here: auto_addfwrs.bat.txt 
          Rename the file to auto_addfwrs.bat (removing the .txt extension at the end),
          Copy this file into the root folder of the program(s) you want to block internet access for (i.e C:\Program files\MyProg\)
        
        Run:
          Right click the script file and select 'Run as Administrator' and it will create firewall rules for all apps in the same folder (and sub folders) as the script file.
          The script will run, and will advise you which rules it has created.
          Once done, you can view the new rules in Windows Firewall (advanced).


v2  Custom version
If you want to run the program from a CMD prompt and customise the firewall rule names, choose this version.

        Install:
          Download addfwrs.bat.txt here: addfwrs.bat.txt
          Rename the file to 'addfwrs.bat' (removing the .txt extension at the end).
          Copy it to a folder included in your CMD path (ie c:\windows\), so that it can be called from anywhere,

        Run: (from any folder)
          Open a CMD prompt (in Administrator mode) change directory to the root folder of the app you want to block (i.e CD C:\Program files\MyProg\)
          Type: addfwrs [press enter]
          Follow the on screen information, it will advise you which rules it is creating.
          Once done, you can view the new rules in Windows Firewall (advanced).


Both versions do the same firewall blocking of apps, but are run differently (whichever is your preferred method).  N.B: It's important to have a unique firewall rule name each time, so that you can identify the added rules when using the Windows firewall at a later stage.  View the new rules contained within your firewall (In/Out rules), change as and when you need to.


All done. Enjoy, hope you find it of use!


ċ
Charles de Havilland,
11 Sep 2015, 02:48
ċ
Charles de Havilland,
11 Sep 2015, 02:49
Comments