WIN7 & Inno-Setup: How to make a program “auto-launch for all users” run under each user's name

北慕城南 提交于 2019-12-24 01:21:53

问题


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?


回答1:


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";



回答2:


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.



来源:https://stackoverflow.com/questions/5530639/win7-inno-setup-how-to-make-a-program-auto-launch-for-all-users-run-under-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!