2014-02-07 54 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