在非提升模式下卸载后如何打开网站? [英] How to open a web site after uninstallation in non-elevated mode?

查看:81
本文介绍了在非提升模式下卸载后如何打开网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在卸载后使用此处发布的代码来启动网页,我注意到ShellExec启动浏览器启动卸载程序时,程序和功能"控制面板默认使用提升的凭据.

Having used the code posted here to launch a web page after uninstall, I note that ShellExec starts the browser with the elevated credentials used by default by the Programs and Features control panel when starting the uninstaller.

使用 ShellExecAsOriginalUser 记录在卸载过程中是不可能的,并且此处提出的建议似乎不适用于想要访问URL的情况.

Using ShellExecAsOriginalUser is documented as not possible during uninstall, and the suggestion made here does not seem to be applicable in the case of wanting to access a URL.

关于如何处理此问题的任何建议?

Any suggestions on how to handle this?

推荐答案

基于如何在PowerShell中使用/不使用提升的特权来运行exe ,这似乎可以解决问题:

Based on How to run exe with/without elevated privileges from PowerShell, this seem to do the trick:

Exec('explorer', 'https://www.example.com/', '', SW_SHOW, ewNoWait, ErrorCode);


我相信它可以工作,因为尽管代码显然在explorer进程中运行,但资源管理器不允许多个实例.因此,新实例将只要求资源管理器的现有实例(未提升)打开URL.现有的非高架浏览器实例将运行Web浏览器的非高架实例.


I believe it works, because while the code obviously runs explorer process elevated, the Explorer does not allow multiple instances. So the new instance will just ask the existing instance of explorer (which is not elevated) to open the URL. The existing non-elevated instance of Explorer will run non-elevated instance of the web browser.

这类似于网络浏览器本身的工作方式.如果您从提升的进程(如un/installer)运行chrome url(或任何其他浏览器),则如果尚未运行任何Chrome进程,则URL将在新的提升的Chrome浏览器中打开.但是,如果某些Chrome进程已经在运行,则新的提升过程将只要求现有的非提升过程打开URL.

It's similar to how the web browsers themselves work. If you run chrome url (or any other browser) from an elevated process (like the un/installer), if no Chrome process is running yet, the URL opens in new elevated Chrome browser. But if some Chrome process is already running, the new elevated process will just ask the existing non-elevated process to open the URL.

唯一的区别是,虽然并非总是有一些Web浏览器进程在运行,但总有一个(未提升的)资源管理器进程.

The only difference is that while there is not always some web browser process running, there is always an (unelevated) Explorer process.

这篇关于在非提升模式下卸载后如何打开网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆