gpt4 book ai didi

windows - 批量高级防火墙异常(exception)(任何方向)

转载 作者:可可西里 更新时间:2023-11-01 14:13:43 26 4
gpt4 key购买 nike

我正在使用此代码将软件“example.exe”添加到异常(exception)列表中:

netsh advfirewall firewall add rule action=allow profile=any protocol=any enable=yes direction=in name=example_in program = "C:\\Program Files\\example.exe" > NUL
netsh advfirewall firewall add rule action=allow profile=any protocol=any enable=yes direction=out name=example_out program = "C:\\Program Files\\example.exe" > NUL

如何在一行中完成“输入|输出”部分?

我的意思是:

netsh advfirewall firewall add rule action=allow profile=any protocol=any enable=yes direction=any name=example_in program = "C:\\Program Files\\example.exe" > NUL

最佳答案

您可以使用快速批处理文件来执行此操作,例如:

for %%x in (in out) do (
netsh advfirewall firewall add rule action=allow profile=any protocol=any enable=yes direction=%%x name=example_%%x program = "C:\\Program Files\\example.exe" > NUL
)

关于windows - 批量高级防火墙异常(exception)(任何方向),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21636637/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com