Windows 10: how to block entire .exe files of a specified folder using .bat file Windows firewall?

Discus and support how to block entire .exe files of a specified folder using .bat file Windows firewall? in Windows 10 Gaming to solve the problem; How to Block entire .exe files of a specified folder in e.g. "C:\ProgramData\" or "C:\Program Files\" Windows Firewall using .bat?I want to run it from... Discussion in 'Windows 10 Gaming' started by Swgwm, Jun 6, 2022.

  1. Swgwm Win User

    how to block entire .exe files of a specified folder using .bat file Windows firewall?


    How to Block entire .exe files of a specified folder in e.g. "C:\ProgramData\" or "C:\Program Files\" Windows Firewall using .bat?I want to run it from pen drive for specified folder in "C:\ProgramData\" or in "C:\Program Files\"Seems like this is exist but it need to be paste at the folder first.---------------------------------------@ setlocal enableextensions @ cd /d "%~dp0" for /R %%f in *.exe do netsh advfirewall firewall add rule name="Blocked: %%f" dir=out program="%%f" action=block pause ---------------------------------------What in my mind is to create a .bat file and past

    :)
     
    Swgwm, Jun 6, 2022
    #1
  2. dark2099 Win User

    Generating a .txt based file list in Windows 7

    I want to be able to generate a .txt file that lists all the files and folders in a specific folder on my PC, but don't know the name of any programs that do that. Searched on google a bit and came up with this guide, but it's for XP and I can't seem to find some of the folder options to modify the .bat file. Any suggestions? Thanks

    http://www.theeldergeek.com/file_list_generator.htm

    EDIT: The .bat file will do what I want if it is in the folder I want to do it in, but the option I want to add is having the right click option that it shows.
     
    dark2099, Jun 6, 2022
    #2
  3. ARC1020 Win User
    How to block multiple EXE files Windows Firewall


    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:
    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.


    how to block entire .exe files of a specified folder using .bat file Windows firewall? [​IMG]



    4) Check your Inbound and Outbound firewall rules afterwards


    how to block entire .exe files of a specified folder using .bat file Windows firewall? [​IMG]



    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.


    how to block entire .exe files of a specified folder using .bat file Windows firewall? [​IMG]



    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.
     
    ARC1020, Jun 6, 2022
    #3
  4. spapakons Win User

    how to block entire .exe files of a specified folder using .bat file Windows firewall?

    How to block multiple EXE files Windows Firewall


    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!

    *Thumbs
     
    spapakons, Jun 6, 2022
    #4
Thema:

how to block entire .exe files of a specified folder using .bat file Windows firewall?

Loading...
  1. how to block entire .exe files of a specified folder using .bat file Windows firewall? - Similar Threads - block entire exe

  2. Default blocking of .exe files?

    in Windows 10 Software and Apps
    Default blocking of .exe files?: Hi all, Today I downloaded a program and noticed that when I tried to open/run the .exe file, nothing would happen. After some digging, I found that when I opened the file's properties, in the "Attributes" it was set to blocked. I checked the "Unblock" box and when I opened...
  3. how to block entire .exe files of a specified folder using .bat file Windows firewall?

    in Windows 10 Software and Apps
    how to block entire .exe files of a specified folder using .bat file Windows firewall?: How to Block entire .exe files of a specified folder in e.g. "C:\ProgramData\" or "C:\Program Files\" Windows Firewall using .bat?I want to run it from pen drive for specified folder in "C:\ProgramData\" or in "C:\Program Files\"Seems like this is exist but it need to be...
  4. how to block entire .exe files of a specified folder using .bat file Windows firewall?

    in Windows 10 Customization
    how to block entire .exe files of a specified folder using .bat file Windows firewall?: How to Block entire .exe files of a specified folder in e.g. "C:\ProgramData\" or "C:\Program Files\" Windows Firewall using .bat?I want to run it from pen drive for specified folder in "C:\ProgramData\" or in "C:\Program Files\"Seems like this is exist but it need to be...
  5. Blocked exe file

    in Windows 10 Software and Apps
    Blocked exe file: I am sure someone somewhere has a virtual voodoo doll of me. This is the exe file for a game I have had since 2007. It has never happened before. I have scanned the folder with Kaspersky. It says its clean. I have switched off UAC, then switched off the pc, and restarted it,...
  6. Entire SID value as an .exe file

    in AntiVirus, Firewalls and System Security
    Entire SID value as an .exe file: Recently I was transferring some files from my NAS device and observed some logs for a file transfer. The file name was exactly like my SID account S-1-5*****8.exe ending with an exe. How is that possible ? is there an explanation for this ? How is a file named after an...
  7. How to find out the list of commands for a .bat or .exe file?

    in Windows 10 Customization
    How to find out the list of commands for a .bat or .exe file?: hard to describe what im looking for i'll do my best to explain in details. example, an image software I use photo.exe when installed it automatically set up shell in registry for windows context menu for files type .bmp/.jpg etc etc. when viewed in registry/shell it show...
  8. Create exe files from bat files using native windows commands

    in Windows 10 Software and Apps
    Create exe files from bat files using native windows commands: Came across this hidden Windows gem I have never seen about converting bat to exe files. I know there are 3rd party apps but was unaware you could do it from Windows iExpress: Convert BAT-files into EXE-files [How-To] | Maintenance and System Tools | Windows Tools, Help...
  9. How to block multiple EXE files Windows Firewall

    in Windows 10 Network and Sharing
    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...
  10. Bat file problem. Windows Cannot Access the Specified Adress or File

    in Windows 10 Support
    Bat file problem. Windows Cannot Access the Specified Adress or File: Hello, I have Windows 10 Home. Version 1703. 64 bit system and 8 GB RAM. I cant run any bat file as it gives me "Windows cannot access the path specified, you may lack additional permissions to open this item." Sometimes run as admin works. But, trying to set...

Users found this page by searching for:

  1. block in and out files in firewall bat file