Windows: How to Block an entire folder | Windows Firewall Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up my name is technobo here for troubleshoot and in today's video i've got a rather niche video for you but it can be incredibly useful if you came looking for this answer basically if you download a program over the internet install it and start using it for whatever reason you may not want it having access to the internet as you probably know opening up a program's folder you'll probably see a bunch of different exes and a bunch of different exes inside of different folders now of course we all know of the windows firewall which we can get to by pressing start typing in firewall and then heading across to windows defender firewall or advanced security when we head across here we'll be able to go into outbound and inbound rules and then block programs one by one or allow them one by one by going to program and selecting where they are however when we do this we're only able to select one exe at a time and not just all of them which is rather unfortunate as we can't target folders with a bunch of exes and programs inside of them this video today is going to show you how you can block or allow for that case every program exe inside of a specific folder and do it recursively so you won't have to worry about subfolders with exes and things hidden inside of them these are of course just different programs over the internet area 2c and ffmpeg these aren't at all viruses or anything like that but of course we all have our own reasons for looking for something like this regardless how do we do it well we can do this really simply on windows with the use of a simple batch file simply navigate to a folder right click and then click new followed by text document you should see new text document.text if you don't see txt afterwards head across to the view tab and make sure filename extensions is checked then we'll be renaming the file to something like script.bat the first part isn't important but only the dot bat at the end is very important turning it into an executable batch file then right-click and click edit if you don't have that option simply open the file with a text editor such as notepad then have a look in the description down below for a simple command that simple command is this over here what exactly does it do well these first two lines only enable extensions and tell it to navigate to this folder over here and we'll then tell it to run whatever commands next inside of this folder over here where the dot batch file is and where we run it from with that out of the way over here we have four slash r meaning for each file recursively meaning subfolders included that are of exe file type do the following net sh atv firewall firewall add rule name equals block dir equals out program equals followed by the path of the actual file and action equals blocked this line over here is the command line option to add rules to the windows firewall which is this over here let's quickly break this command apart this command over here adds a rule to the windows firewall netsh advanced firewall firewall add rule simply tells us to create a new rule dir is direction out so we'll head across to the outbound tab create a new rule and that's basically what the command has done then the program is the exe file inside of our folder so program file and does this then the action is listed over here block so block the connection then this last section over here is the last part of the command name equals blocked percentage f so it'll show up as blocked followed by the path of the file itself that's basically what this command over here does we can change the direction from just outbound to just inbound and action block we can change that to say allow so let's say that we want to block programs inbound and outbound how do we do that well we can add multiple commands inside of these brackets over here so we can duplicate it and add an inner direction as well as an out direction this way a program is blocked from getting data in and sending data out and of course we can change it to allow data in and out now that we've told the script to block exes inside of a folder in both the in and out direction let's go ahead and test it out in that case i'll simply navigate out of the firewall then i'll locate the batch script right-click and then click run as admin there we go some commands were ran and the file paused at the very end by default it doesn't pause at the very end this window just disappears but i added a line to the script over here pause which gets it to stay on my screen waiting for a key input either way looking at this we can see that it simply ran the command and blocked each exe inbound and outbound okay okay so let's go ahead and have a look at the advanced firewall window over here i'll go to action followed by refresh and we'll head down to b so i'll sort by name and we can see a bunch of blocked entries over here making it a bit bigger we can see c uses technobo desktop test which is this folder over here c uses the technopa desktop test and then we've got area 2c ffmpeg times 3 and an ffmpeg folder inside of this folder over here great so it worked as expected having a look in the inbound section we have the exact same thing where all of these programs are blocked on the inbound route great so it worked exactly as expected we can of course select them all and hit the delete button to get rid of those rules i'll of course be doing them as i've just got these here temporarily here we go super simple you should be able to do something with this and hopefully this video answered your question if you had one thank you for watching my name has been technobaby here for troubleshoot and i'll see you all next time ciao
Info
Channel: TroubleChute
Views: 71,196
Rating: undefined out of 5
Keywords: windows firewall, firewall block all exes, block all of the game exes in your system firewall, use a firewall to block all game exe from going online, firewall, windows 10, block, tutorial, internet, windows, firewall block folder, block folder in windows firewall, how to block folder in firewall windows 10, firewall block entire folder, firewall block folders, windows firewall block all exe in folder, windows firewall block shared folder, windows 10 firewall block shared folder
Id: 4AH4SV7bGN0
Channel Id: undefined
Length: 5min 47sec (347 seconds)
Published: Fri Sep 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.