如何以普通用户身份从 UAC 提升的安装程序启动程序
我正在编写一个 NSIS 安装程序,安装程序根据需要在 Windows 7 / vista 上提升“管理员身份”。 我需要在安装结束时运行已安装的程序,并且不想以与安装程序相同的权限启动它。
常规 NSIS exec 命令使用与安装程序相同的权限运行子进程。
NSIS 有一个 UAC 插件,但是它的文档不是很好,而且看起来很新;我不想使用该插件。
理想情况下,我正在寻找一个可以包含在内的小型 .exe,它将在不提升 UAC 的情况下启动目标程序。这存在吗?
还有其他建议吗?
谢谢!
I'm writing an NSIS installer and the setup program elevates "as administrator" as needed on Windows 7 / vista.
I need to run the installed program at the end of the install and don't want to launch it with the same privileges as the installer.
The regular NSIS exec commands run the child process with the same permissions as the installer.
There is a UAC plugin for NSIS, but the documentation on it isn't great and it seems v. new; I'd prefer not to use that plugin.
Ideally, I'm looking for a small .exe I can include that'll launch the target program without UAC elevation. Does this exist?
Any other suggestions?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你只有两个选择:
没有可以使用的外部程序,因为不可能从提升的进程返回到原始用户(您可以尝试,并非常接近,但它不会在每种情况下都获得正确的用户)
You only have two options:
There is no external program you can use since it is impossible to get back to the original user from a elevated process (You can try, and get pretty close, but it will not get the correct user in every case)
我发现以下内容,可以将其包装成一个简单的命令行实用程序:
http://brandonlive.com/2008/04/27/getting-the-shell-to-run-an-application-for-you-part -2-how/
只花了大约一个小时就让该代码在我的项目中工作,并且到目前为止它工作完美。 ;)
I found the following, which could be wrappered into a a simple command line utility:
http://brandonlive.com/2008/04/27/getting-the-shell-to-run-an-application-for-you-part-2-how/
It only took about an hour to get that code working for my project, and it works flawlessly so far. ;)