1.添加应用程序清单文件(app.manifest)

需要以管理员的身份运行程序(winform)

2.打开app.manifest,将<requestedExecutionLevel level="asInvoker" uiAccess="false" />改为<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />,

需要以管理员的身份运行程序(winform)

3.ok拉。。

 

参考:https://blog.csdn.net/wm111/article/details/77990745

相关文章: