简单问题:如果您在 Windows 8 上运行应用程序,有没有办法只要求管理权限?
到目前为止,我看到的唯一方法是调用一个外部程序来杀死并以管理员权限重新打开它,如果它是在 Windows 8 上的话。我所说的外部程序是指一个 vb 脚本。
但是这种方法真的很不安全,而且有点脏。
我之所以问,是因为在 Windows 8 上,如果没有管理员权限,您将无法再做很多小事情。就像在程序文件文件夹中写入/删除文件以及访问/操作具有管理员权限的其他进程一样。
简单问题:如果您在 Windows 8 上运行应用程序,有没有办法只要求管理权限?
到目前为止,我看到的唯一方法是调用一个外部程序来杀死并以管理员权限重新打开它,如果它是在 Windows 8 上的话。我所说的外部程序是指一个 vb 脚本。
但是这种方法真的很不安全,而且有点脏。
我之所以问,是因为在 Windows 8 上,如果没有管理员权限,您将无法再做很多小事情。就像在程序文件文件夹中写入/删除文件以及访问/操作具有管理员权限的其他进程一样。
To the best of my knowledge, there is no way for a process running without an elevated token to become elevated. It can launch a new process elevated using ShellExecute with the "runas" verb (see http://blogs.msdn.com/b/vistacompatteam/archive/2006/09/25/771232.aspx). Of course a UAC prompt will show. If you really want to detect Windows 8 and only have the UAC prompt come up there and not on Windows 7, you can write a wrapper over your main application which launches your main application with UAC prompt on Win8.