【问题标题】:SetVolumeLabel function getting failed due to access denied error on Windows 7由于 Windows 7 上的访问被拒绝错误,SetVolumeLabel 函数失败
【发布时间】:2013-04-18 05:57:55
【问题描述】:

SetVolumeLabel 函数因 Windows 7 上的访问被拒绝错误而失败。

同样的功能在 Windows XP 上运行良好。

知道为什么这个问题出现在 Windows 7 上而不是 XP 上。

任何帮助将不胜感激,对我们非常有帮助。

【问题讨论】:

  • 您很可能需要使用提升的权限运行代码。

标签: windows-7 uac windows-7-x64 msdn


【解决方案1】:

Windows Vista 和 Windows 7 具有 User Account Control 或 UAC。这意味着除非针对特定操作或应用程序请求,否则用户没有管理员权限。在 Windows XP 下,如果用户是管理员,则所有程序都以管理员权限运行。

您收到的错误表明SetVolumeLabel 需要提升权限。您可以使用“runas”以管理员身份运行应用程序,也可以将程序更改为request elevation

【讨论】:

    猜你喜欢
    • 2011-04-29
    • 2012-07-23
    • 2023-04-08
    • 1970-01-01
    • 2017-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多