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

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

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

3.ok拉。。

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

原文地址:https://www.cnblogs.com/yaosj/p/10877317.html