Skip to content

Commit

Permalink
(#557) InnoSetup allow to choose between scheduled task or registry s…
Browse files Browse the repository at this point in the history
…tartup
  • Loading branch information
jibedoubleve committed Aug 2, 2024
1 parent e49364a commit d346d7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions install_script/AddScheduledTask.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
set AppPath=%1
schtasks /Create /TN "MonApplication" /TR "\"%AppPath%\"" /SC ONLOGON /RL HIGHEST /F
12 changes: 10 additions & 2 deletions setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define MyAppExeName "Lanceur.exe"

[Setup]
PrivilegesRequired=admin
PrivilegesRequired=none
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
Expand All @@ -38,11 +38,19 @@ Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
; Name: startup; Description: "Automatically start on login"; GroupDescription: "{cm:AdditionalIcons}"
; Chose how the appplications starts up
Name: "startregistry"; Description: "Start the application via the registry"; GroupDescription: "Startup options"
Name: "starttask"; Description: "Start the application via a scheduled task"; GroupDescription: "Startup options"

[Registry]
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Lanceur 2"; ValueData: """{app}\{#MyAppExeName}"""; Flags: uninsdeletevalue

[Run]
Filename: "{app}\AddScheduledTask.bat"; Parameters: """{app}\{#MyAppExeName}"""; Flags: runhidden; Tasks: starttask

[UninstallRun]
Filename: "schtasks"; Parameters: "/Delete /TN {#MyAppName} /F"; Flags: runhidden

[Files]
Source: "{#BinDirectory}{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#BinDirectory}*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Expand Down

0 comments on commit d346d7a

Please sign in to comment.