WIN7& Inno-Setup:如何使程序“为所有用户自动启动”以每个用户名运行

发布于 2024-10-28 21:15:32 字数 1061 浏览 1 评论 0原文

这个问题源于我的另一个问题。请此处查看更多背景信息。

从另一篇文章来看,事实证明我的应用程序必须在当前帐户持有人的姓名下运行。我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三生一梦 2024-11-04 21:15:32

我不小心将以下行添加到我的 inno 安装脚本中,结果是我的程序在每次启动时自动启动。

[Icons]
Name: "{commonstartup}\LoopJam"; Filename: "{app}\resources\LoopJam.exe"; IconFilename: "{app}\LoopJam.ico";

I accidently added the following line to my inno setup script with the result, that my program was started automatically on every startup.

[Icons]
Name: "{commonstartup}\LoopJam"; Filename: "{app}\resources\LoopJam.exe"; IconFilename: "{app}\LoopJam.ico";
盛夏已如深秋| 2024-11-04 21:15:32

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文