2014-02-07 16 views
4

我使用此代码软件“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 

我该怎么办“的|去”的一部分只有一条线?

我的意思是这样的:

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 

回答

4

你可以用像quicky批处理文件这样做:

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 
) 
+0

感谢,这是件好事,但它并没有真正存在任何“任何”为方向论点? :S – user3108594

+1

根据帮助,否: 'netsh advfirewall防火墙添加规则?' – Mark