WIN7& Inno-Setup:如何使程序“为所有用户自动启动”以每个用户名运行
这个问题源于我的另一个问题。请此处查看更多背景信息。
从另一篇文章来看,事实证明我的应用程序必须在当前帐户持有人的姓名下运行。我正在使用 Inno-setup 来安装这个应用程序。有一个选项可以安装“仅针对当前用户自动启动”或“针对所有用户自动启动”。但是,这两个选项似乎都不适合我,因为程序总是在“admin”用户下启动,这使得我的应用程序无法运行。
如果我从标准用户帐户安装应用程序,则必须以其他用户(管理员)身份运行安装。在这种情况下,我也无法使用“仅针对当前用户自动启动”选项,因为安装程序的“当前用户”是管理员,而不是标准用户,正如我发现的那样。
经过一番努力,我发现,我不得不放弃 inno-setup 的“自动启动”功能。首先以不同的用户(管理员)身份从标准帐户安装它。然后,我必须手动向 HKCU\Software\Microsoft\Windows\CurrentVersion\Run 添加一个条目,以便在 Windows 启动时自动启动。这可行,但我不敢相信没有更好的方法来做到这一点。
这是相关的 inno-setup 脚本:
[Tasks]
Name: startup; Description: "Launch automatically when Windows starts up"; GroupDescription: "Additional icons:"
Name: startup\user; Description: "For the current user only"; GroupDescription: "Additional icons:"; Flags: exclusive unchecked
Name: startup\common; Description: "For all users"; GroupDescription: "Additional icons:"; Flags: exclusive
我正在使用最新的 Inno-Setup (v5.4.2)。我在这里错过了什么吗?
This question resulted from my another question. Please see more background here.
From the other post, it turns out my app has to run under current account holder's name. I'm using Inno-setup for installing this app. There is a option to install "auto-launch for current user only" or "auto-launch for all users". However, both options don't seem to work for me, because the program always starts under "admin" user, which makes my app not run.
If I install the app from a standard user account, I had to run the install as a different user (admin). In this case, I can't use "auto-launch for current user only" option either because 'current user' to installer is admin, not standard user, as I found out.
After much strugle, as I figured out, I had to abandon the inno-setup's "auto-launch" feature. Install it from standard account as a different user (admin) first. Then, I had to manually add an entry to HKCU\Software\Microsoft\Windows\CurrentVersion\Run to make auto-launch on windows startup. This works, but I can't believe there isn't a better way to do it.
Here is the related inno-setup script:
[Tasks]
Name: startup; Description: "Launch automatically when Windows starts up"; GroupDescription: "Additional icons:"
Name: startup\user; Description: "For the current user only"; GroupDescription: "Additional icons:"; Flags: exclusive unchecked
Name: startup\common; Description: "For all users"; GroupDescription: "Additional icons:"; Flags: exclusive
I'm using the latest Inno-Setup (v5.4.2). Did I miss anything here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不小心将以下行添加到我的 inno 安装脚本中,结果是我的程序在每次启动时自动启动。
I accidently added the following line to my inno setup script with the result, that my program was started automatically on every startup.
Inno 没有“自动启动”功能,并且您忽略了向我们展示实际创建 Run 值的行。
话虽如此,只需添加 HKLM 资源管理器运行密钥即可使其在登录时为每个用户运行。
Inno doesn't have an "autolaunch" feature, and you neglected to show us the lines that actually create the Run values.
Having said that, just adding to the HKLM explorer run key will cause it to run for each user on login.