有没有哪个大神帮忙写个在文件夹上右键,断网和恢复联网文件夹下所以exe文件的程序?
本帖最后由 rzsggg 于 2023-9-26 17:51 编辑在文件夹上右键菜单,会出现选项“限制联网”,“恢复联网”,然后文件夹下的所有exe文件都不能联网。
这是论坛里面人家发的批处理里面找到的!
@echo off
::为.exe程序快捷添加防火墙规则
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules" /f /v "MUIVerb" /t REG_SZ /d "防火墙规则"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules" /f /v "Icon" /t REG_SZ /d "FirewallControlPanel.dll,0"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules" /f /v "SubCommands" /t REG_SZ /d ""
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item0" /f /v "MUIVerb" /t REG_SZ /d "禁止入站"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item0" /f /v "Icon" /t REG_SZ /d "imageres.dll,-105"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item0\Command" /f /ve /t REG_SZ /d "mshta vbscript:createobject(\"shell.application\").shellexecute(\"netsh.exe\",\"advfirewall firewall add rule name = \"\"%%1\"\" dir = in program = \"\"%%1\"\" action = block\",\"\",\"runas\",0)(close)"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item1" /f /v "MUIVerb" /t REG_SZ /d "禁止出站"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item1" /f /v "Icon" /t REG_SZ /d "imageres.dll,-105"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item1\Command" /f /ve /t REG_SZ /d "mshta vbscript:createobject(\"shell.application\").shellexecute(\"netsh.exe\",\"advfirewall firewall add rule name = \"\"%%1\"\" dir = out program = \"\"%%1\"\" action = block\",\"\",\"runas\",0)(close)"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item2" /f /v "MUIVerb" /t REG_SZ /d "允许入站"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item2" /f /v "Icon" /t REG_SZ /d "imageres.dll,-106"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item2\Command" /f /ve /t REG_SZ /d "mshta vbscript:createobject(\"shell.application\").shellexecute(\"netsh.exe\",\"advfirewall firewall delete rule name = \"\"%%1\"\" dir = in program = \"\"%%1\"\"\",\"\",\"runas\",0)(close)"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item3" /f /v "MUIVerb" /t REG_SZ /d "允许出站"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item3" /f /v "Icon" /t REG_SZ /d "imageres.dll,-106"
reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item3\Command" /f /ve /t REG_SZ /d "mshta vbscript:createobject(\"shell.application\").shellexecute(\"netsh.exe\",\"advfirewall firewall delete rule name = \"\"%%1\"\" dir = out program = \"\"%%1\"\"\",\"\",\"runas\",0)(close)"
reg add "HKCR\DesktopBackground\shell\Item0\shell\Item5" /f /v "MUIVerb" /t REG_SZ /d "防火墙规则"
所以? 搞个网卡停用/恢复的快捷操作也可以吧? 谢谢fulibo大佬 fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!
谢谢 学习学习了 了解学习一下
有个防火墙软件可以实现同样的功能,免费小巧,防火墙-Firewall App Blocker
可以选择文件夹,里面的所有EXE文件都会添加到防火墙规则里
进来学习一下,谢谢大佬 学习了,谢谢 fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!
我用了你这个批处理后,显示乱码,在文件夹的右键菜单不会显示,只在EXE文件右键菜单才会显示
本帖最后由 fulibo 于 2023-9-30 14:25 编辑
9chengwo 发表于 2023-9-30 13:42
我用了你这个批处理后,显示乱码,在文件夹的右键菜单不会显示,只在EXE文件右键菜单才会显示
ANSI格式!
本帖最后由 9chengwo 于 2023-10-1 09:16 编辑
fulibo 发表于 2023-9-30 14:24
ANSI格式!
我改了格式,现在不会乱码了,但是我把某个EXE文件用这个禁止入站和禁止出站,
为啥在防火墙规则设置里面看不到新建的规则呢?似乎这些命令没有起作用啊
我系统是Win11
本帖最后由 huqiu2 于 2023-10-18 17:39 编辑
fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!只能在exe上面生效,跟楼主要求不符
https://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif 学习学习了 这功能也能实现? 下了个simplefire防火墙,真好用。主要是有些软件太顽固,会把系统自带防火墙禁用后联网,然后会做一些手脚。这个批处理留着备用了。 还是所以exe
页:
[1]