In my installation kit, I ask user if he wants to install a scheduled task.
So, I use an entry in the Tasks
section to get his choice.
[Tasks]
Name: CheckNewVersion; Description: "Create a scheduled task to inform me when a new version is available"; GroupDescription: "New version"; Components: CheckNewVersion
In the Run section, I have the command line to install the scheduled task.
[Run]
Filename: "schtasks"; Parameters: "/CREATE /F /SC DAILY /TN ""Kit ITO SWM"" /TR ""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file {app}\checkNewVersion.ps1"" /ST 09:00";
I want it to be run only if the user chose to install it.
As with any other section, even in the Run
section, there's Tasks
parameter that can be used to link the entry to specific task(s):
[Run]
Filename: "schtasks"; Parameters: "..."; Tasks: CheckNewVersion
See Components and Tasks Parameters in Inno Setup documentation.