In Windows Firewall with Advanced Settings I can create a rule which blocks all inbound or outbound traffic for particular program by pointing to its .exe file. The problem is that this program has many .exe files in its directory, as well as additional ones in its sub directories. So many question is: do I need to make separate rules for each .exe file, which in this case would mean about 50 rules or is there a way to block the traffic for a group of .exe files based on their location on the local hard drive. Thank you.
*Configure and Add rules in windows firewall based on dynamic content (exe files) in that folder: *
you should work with PowerShell or command line tools that run everyday.
like this : Article Link
There are also some good VBScript samples on MSDN which I used as a starting point.
open ISA Server Management, click Start, point to All Programs, point to Microsoft ISA Server, and then click ISA Server Management.
Block responses containing Windows executable content visit this Article here
in our network that based on windows we have cache server named SQUID :
Squid content filtering: Block / download of music MP3, mpg, mpeg, exec files
If the .exe's are located in the same folder you can probably add it in the windows firewall list.If they are located in different folders then you have to manually add those.In general,the firewall will ask for user's permission if an .exe tries to access the network i.e one that is not recognized as a trusted application.But it wont track what are the individual exe's that are called inturn by that process.You can either disable all ports or specific ports.
In general the windows firewall is not my recommendation unless you update your windows everyday.Use Comodo's free edition to have better control and it can be easily setup.
Although @saber tabatabaee yazdi answer is much more thorough.
You can use a Simple Batch File. Open Notepad and copy/paste the script below into a blank document. Save the file as BLOCKALL.BAT. Now copy that file to the same directory as the EXEs you want to block and double click it. It will add outbound rules to advanced Windows Firewall settings blocking all EXEs in that folder and sub-folders as well.
I tested this with Windows 7, but I think it should work with other versions of Windows that use Windows Firewall.
for /R %%a in (*.exe) do (
netsh advfirewall firewall add rule name="Blocked with Batchfile %%a" dir=out program="%%a" action=block