Inno Setup - 如何在用户登录Windows时运行程序?

Kei*_*Jr. 11 inno-setup

我想使用Inno Setup(http://www.jrsoftware.org/isfaq.php)为应用程序构建安装程序.

我希望只要用户在Windows计算机上登录其帐户,就会启动此应用程序.

如何告诉Inno安装程序在用户登录时启动程序?

Ser*_*yuz 30

在所有用户配置文件的启动文件夹中放置快捷方式.请参阅知识库文章" 在启动(或自动启动)组中创建快捷方式 ",其中包括以下示例:

[Setup]
PrivilegesRequired=admin

[Icons] 
Name: "{commonstartup}\My Program"; Filename: "{app}\MyProg.exe"
Run Code Online (Sandbox Code Playgroud)

如果您希望程序仅在安装程序的用户登录时运行,则使用{userstartup}而不是{commonstartup}.在这种情况下,不需要管理员权限.


或者,如果您决定写入注册表的"运行"键(kb文章):

[Registry]
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "MyProg"; ValueData: """{app}\MyProg.exe"""; Flags: uninsdeletevalue
Run Code Online (Sandbox Code Playgroud)

如果您使用"HKLM",则需要再次使用管理员权限.