无忧启动论坛

标题: 有没有哪个大神帮忙写个在文件夹上右键,断网和恢复联网文件夹下所以exe文件的程序? [打印本页]

作者: rzsggg    时间: 2023-9-26 10:10
标题: 有没有哪个大神帮忙写个在文件夹上右键,断网和恢复联网文件夹下所以exe文件的程序?
本帖最后由 rzsggg 于 2023-9-26 17:51 编辑

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


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

  1. @echo off

  2. ::为.exe程序快捷添加防火墙规则
  3. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules" /f /v "MUIVerb" /t REG_SZ /d "防火墙规则"
  4. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules" /f /v "Icon" /t REG_SZ /d "FirewallControlPanel.dll,0"
  5. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules" /f /v "SubCommands" /t REG_SZ /d ""
  6. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item0" /f /v "MUIVerb" /t REG_SZ /d "禁止入站"
  7. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item0" /f /v "Icon" /t REG_SZ /d "imageres.dll,-105"
  8. 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)"
  9. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item1" /f /v "MUIVerb" /t REG_SZ /d "禁止出站"
  10. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item1" /f /v "Icon" /t REG_SZ /d "imageres.dll,-105"
  11. 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)"
  12. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item2" /f /v "MUIVerb" /t REG_SZ /d "允许入站"
  13. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item2" /f /v "Icon" /t REG_SZ /d "imageres.dll,-106"
  14. 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)"
  15. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item3" /f /v "MUIVerb" /t REG_SZ /d "允许出站"
  16. reg add "HKCR\SystemFileAssociations\.exe\shell\FirewallRules\Shell\Item3" /f /v "Icon" /t REG_SZ /d "imageres.dll,-106"
  17. 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)"
  18. reg add "HKCR\DesktopBackground\shell\Item0\shell\Item5" /f /v "MUIVerb" /t REG_SZ /d "防火墙规则"
复制代码


作者: szwp    时间: 2023-9-26 11:42
所以?
作者: wjqok    时间: 2023-9-26 12:13
搞个网卡停用/恢复的快捷操作也可以吧?
作者: rzsggg    时间: 2023-9-26 17:53
谢谢fulibo大佬
作者: yc2428    时间: 2023-9-26 18:26
fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!

谢谢
作者: nathan6498    时间: 2023-9-26 19:28
学习学习了
作者: awan8850    时间: 2023-9-27 11:25
了解学习一下
作者: 9chengwo    时间: 2023-9-27 13:39


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

作者: kala2018    时间: 2023-9-27 18:47
进来学习一下,谢谢大佬
作者: softwarezheng    时间: 2023-9-29 18:12
学习了,谢谢
作者: 9chengwo    时间: 2023-9-30 13:42
fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!




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

作者: fulibo    时间: 2023-9-30 14:24
本帖最后由 fulibo 于 2023-9-30 14:25 编辑
9chengwo 发表于 2023-9-30 13:42
我用了你这个批处理后,显示乱码,在文件夹的右键菜单不会显示,只在EXE文件右键菜单才会显示

ANSI格式!

2023-09-30_14-25-28.png (124.28 KB, 下载次数: 67)

2023-09-30_14-25-28.png

作者: 9chengwo    时间: 2023-10-1 09:15
本帖最后由 9chengwo 于 2023-10-1 09:16 编辑
fulibo 发表于 2023-9-30 14:24
ANSI格式!

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

我系统是Win11

作者: huqiu2    时间: 2023-10-18 17:37
本帖最后由 huqiu2 于 2023-10-18 17:39 编辑
fulibo 发表于 2023-9-26 10:56
这是论坛里面人家发的批处理里面找到的!
只能在exe上面生效,跟楼主要求不符

作者: 无犹启动    时间: 2023-11-1 08:18
学习学习了
作者: coxlxd    时间: 2023-11-10 10:25
这功能也能实现?
作者: rzsggg    时间: 2024-1-7 10:00
下了个simplefire防火墙,真好用。主要是有些软件太顽固,会把系统自带防火墙禁用后联网,然后会做一些手脚。这个批处理留着备用了。
作者: szwp    时间: 2024-1-7 10:24
还是所以exe
作者: Ukyo    时间: 4 小时前
用批处理来启用网络看来是最方便的




欢迎光临 无忧启动论坛 (http://bbs.c3.wuyou.net/) Powered by Discuz! X3.3