I want to use Inno Setup (http://www.jrsoftware.org/isfaq.php) to build an installer for an application.
I want this application to start whenever a user logs in to
Put a shortcut in the startup folder of All Users profile. See the knowledge base article 'Create shortcuts in the Startup (or Autostart) group' which includes the below example:
[Setup]
PrivilegesRequired=admin
[Icons]
Name: "{commonstartup}\My Program"; Filename: "{app}\MyProg.exe"
If you want the program to run only when the user that installed the program logs in, then use {userstartup} instead of {commonstartup}. In that case admin privileges is not required.
Or if you decide to write to 'Run' key of registry (kb article):
[Registry]
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "MyProg"; ValueData: """{app}\MyProg.exe"""; Flags: uninsdeletevalue
If you use 'HKLM', again admin privileges is required.
Maybe it would be helpful for someone...
I encountered some problems under windows 8 when trying to build setup that would automatically put autorun registry key such as:
Root: "HKCU"; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "NHMMNAS"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
for running my 32-bit .NET application on every Windows startup.
It occured that for 32-bit application a little modification was needed which was replacing Root: "HKCU"
with Root: "HKCU32"
so the entry in setup script was:
Root: "HKCU32"; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "NHMMNAS"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
After adding the line and reinstalling, my application started on system startup with no problems.