高级防火墙exception批量(任何方向)

我正在使用此代码将软件“example.exe”添加到例外列表中:

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 

我怎样才能做一个唯一的行“in | out”部分?

我的意思是这样的:

 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 )