Windows 10: How to block multiple EXE files Windows Firewall Solved

Page 2 of 2 FirstFirst 12
  1.    19 Aug 2017 #11

    jpeni said: View Post
    Use this batch file to add exe and dll files to Firewall in Windows 10

    Problem is: when you run this batch file as Admin

    it asks whether you want to block Windows/System32 and all its subfolders---NOT EXACTLY WHAT MOST EVERYONE WOULD DESIRE !
    Last edited by Brink; 11 Jan 2018 at 17:38. Reason: fixed quote box
      My ComputerSystem Spec

  2.    19 Aug 2017 #12

    ARC1020 said: 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
    .
    .
    .
    .
    .
    etc. etc.

    Tried all of that....didn't do anything...no rules were added.

    EDIT:
    OOOPPSS !! My bad....I didn't try refreshing the rules page ! IT DOES WORK THOUGH!! GREAT THANKS
    Last edited by Brink; 11 Jan 2018 at 17:39. Reason: fixed quote box
      My ComputerSystem Spec

  3.    19 Aug 2017 #13

    It would help a lot of people if someone could add to that code so that the user specifies a folder and the batch file creates blocking inbound/outbound rules for every .exe and .dll including every subfolder. I just don’t know how… I only speak Java and C++
    ...I don't know anything about the syntax for these batch files
      My ComputerSystem Spec

  4.    19 Aug 2017 #14

    Actually some one already did that:
    https://sites.google.com/site/mytool...ws-7-firewall/
      My ComputerSystem Spec

  5.    04 Jan 2018 #15

    How could I add this script below another script (together) in a .bat and that would run portable (from other places) for example: from E:\ and look for all the .exe of a folder in another location for example: "%ProgramFiles% Myprogram" ?Thanks in advance!
      My ComputerSystem Spec


  6. Posts : 2,436
    Windows 10 Pro 64-bit 1709 (FCU build 16299.248)
    Thread Starter
       04 Jan 2018 #16

    MaicoRossoni said: View Post
    How could I add this script below another script (together) in a .bat and that would run portable (from other places) for example: from E:\ and look for all the .exe of a folder in another location for example: "%ProgramFiles% Myprogram" ?Thanks in advance!
    You don't have to create a bat file. You save the script file on a USB flash drive (see previous posts how to create it) and then you simply run it as Administrator.
      My ComputerSystem Spec

  7.    11 Jan 2018 #17

    Thanks for the comment spapakons. I was wondering if there is any way to add this escript to block all .exe from the program folder. for example, after installing it silently. Without having to manually move to the installed folder understand. All in one single batMay .batfile:@setlocal enableextensions@cd /d "%~dp0"start /wait "may program.exe" /spara %% G in ("C:\Program Files (x86)\My program\*.exe") do (netsh advfirewall firewall adicionar nome da regra = "Bloqueado com Batchfile %% G" dir = em ação = bloco programa = "%% G" habilitar = sim perfil = qualquernetsh advfirewall firewall adicionar nome da regra = "Bloqueado com Batchfile %% G" dir = out action = block program = "%% G" enable = yes profile = any)exit
      My ComputerSystem Spec

  •    18 Jan 2018 #18

    Thank youworks well !!Sorry for the other comments from me.Just one more question, how could I do to run the folder and subfolders ...?Thanks in advance
      My ComputerSystem Spec


  •  
    Page 2 of 2 FirstFirst 12

    Related Threads
    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...
    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...
    How to block downloading upgrade to Windows 10? in Windows Updates and Activation
    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...
    Block Windows Update downloading on WIn 10 Home? in Windows Updates and Activation
    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...
    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...
    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 12:58.
    Find Us