rzsggg 发表于 2023-9-26 10:10:59

有没有哪个大神帮忙写个在文件夹上右键,断网和恢复联网文件夹下所以exe文件的程序?

本帖最后由 rzsggg 于 2023-9-26 17:51 编辑

在文件夹上右键菜单,会出现选项“限制联网”,“恢复联网”,然后文件夹下的所有exe文件都不能联网。

fulibo 发表于 2023-9-26 10:56:03

这是论坛里面人家发的批处理里面找到的!

@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 "防火墙规则"

szwp 发表于 2023-9-26 11:42:27

所以?

wjqok 发表于 2023-9-26 12:13:26

搞个网卡停用/恢复的快捷操作也可以吧?

rzsggg 发表于 2023-9-26 17:53:36

谢谢fulibo大佬

yc2428 发表于 2023-9-26 18:26:10

fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!

谢谢

nathan6498 发表于 2023-9-26 19:28:04

学习学习了

awan8850 发表于 2023-9-27 11:25:48

了解学习一下

9chengwo 发表于 2023-9-27 13:39:35



有个防火墙软件可以实现同样的功能,免费小巧,防火墙-Firewall App Blocker
可以选择文件夹,里面的所有EXE文件都会添加到防火墙规则里

kala2018 发表于 2023-9-27 18:47:29

进来学习一下,谢谢大佬

softwarezheng 发表于 2023-9-29 18:12:51

学习了,谢谢

9chengwo 发表于 2023-9-30 13:42:55

fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!




我用了你这个批处理后,显示乱码,在文件夹的右键菜单不会显示,只在EXE文件右键菜单才会显示

fulibo 发表于 2023-9-30 14:24:07

本帖最后由 fulibo 于 2023-9-30 14:25 编辑

9chengwo 发表于 2023-9-30 13:42
我用了你这个批处理后,显示乱码,在文件夹的右键菜单不会显示,只在EXE文件右键菜单才会显示
ANSI格式!

9chengwo 发表于 2023-10-1 09:15:11

本帖最后由 9chengwo 于 2023-10-1 09:16 编辑

fulibo 发表于 2023-9-30 14:24
ANSI格式!
我改了格式,现在不会乱码了,但是我把某个EXE文件用这个禁止入站和禁止出站,
为啥在防火墙规则设置里面看不到新建的规则呢?似乎这些命令没有起作用啊

我系统是Win11

huqiu2 发表于 2023-10-18 17:37:01

本帖最后由 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

无犹启动 发表于 2023-11-1 08:18:02

学习学习了

coxlxd 发表于 2023-11-10 10:25:17

这功能也能实现?

rzsggg 发表于 2024-1-7 10:00:15

下了个simplefire防火墙,真好用。主要是有些软件太顽固,会把系统自带防火墙禁用后联网,然后会做一些手脚。这个批处理留着备用了。

szwp 发表于 2024-1-7 10:24:22

还是所以exe
页: [1]
查看完整版本: 有没有哪个大神帮忙写个在文件夹上右键,断网和恢复联网文件夹下所以exe文件的程序?