码迷,mamicode.com
首页 > 移动开发 > 详细

Programmatically add an application to Windows Firewall

时间:2020-05-10 15:15:24      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:hive   Requires   man   follow   rap   call   abi   should   miss   

Programmatically add an application to Windows Firewall

回答1

 

Not sure if this is the best way, but running netsh should work:

netsh firewall add allowedprogram C:\MyApp\MyApp.exe MyApp ENABLE

I think this requires Administrator Permissions though,for obvious reasons :)

Edit: I just don‘t know enough about ClickOnce to know whether or not you can run external programs through it.

 

 

回答2

I found this article, which has a complete wrapper class included for manipulating the windows firewall. Adding an Application to the Exception list on the Windows Firewall

http://web.archive.org/web/20070707110141/http://www.dot.net.nz/Default.aspx?tabid=42&mid=404&ctl=Details&ItemID=8

 

 

 

 

 

 

Programmatically add an application to Windows Firewall

标签:hive   Requires   man   follow   rap   call   abi   should   miss   

原文地址:https://www.cnblogs.com/chucklu/p/12863130.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!