Inno Setup, APP start When windows start

后端 未结 1 953
野性不改
野性不改 2020-12-29 12:08

For Inno Setup, I would like to create a checkbox Task for MyAPP Auto Start when Windows Start. My code like below :

And, How to write the codes below - DO_Set_AutoS

相关标签:
1条回答
  • 2020-12-29 12:48

    You don't need to make use of the [code] section to add an automatic starting app.

    There are different ways to accomplish this, for example

    [icons]
    Name: "{userstartup}\My Program"; Filename: "{app}\MyProg.exe"; Tasks:StartMenuEntry;
    Name: "{commonstartup}\My Program"; Filename: "{app}\MyProg.exe"; Tasks:StartMenuEntry;
    

    The difference between {userstartup} and {commonstartup}, if not obvious, is that {userstartup} affects the startup menu entry for the current user and {commonstartup} affects all the users of the target machine.


    Edit

    You may also use the registry to start an application. I'm adding this because the OP mentioned in comments the described method doesn't work on windows 8 (because the lack of start menu, which I forgot). I have no windows 8 at hand to test, so it's up to you to test if this works on windows 8 or not.

    The Run keys in the registry exists since WinXP, so you can configure windows to auto-run a program from the installer adding something like this:

    [Registry]
    ;current user only
    Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "MyProgram"; ValueData: "{app}\MyProg.exe"; Tasks:AutoRunRegistry;
    
    ;any user
    Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "MyProgram"; ValueData: "{app}\MyProg.exe"; Tasks:AutoRunRegistry;
    

    Don't miss I'm also changing the Tasks parameter in the example to AutoRunRegistry.

    0 讨论(0)
提交回复
热议问题