I have a small console application that is installed along my (bigger) application. The setup is created with Inno Setup, which works very nice.
I want Inno Setup to
To give a more concrete example than the @TLama's answer:
For example, to schedule a task to run your application with some parameter every hour, use:
[Run]
Filename: "schtasks"; \
Parameters: "/Create /F /SC HOURLY /TN ""My Task"" /TR ""'{app}\MyProg.exe' par1"""; \
Flags: runhidden
Note:
/F
switch to overwrite any existing task with the same name (important for re-installations/upgrades).See a full documentation for the schtasks.exe command and the [Run] section.
When you want to debug a non-working task creation, start the schtasks
with the cmd.exe /K
(and of course, remove the runhidden
flag):
[Run]
Filename: "{cmd}"; \
Parameters: "/K schtasks /F /Create /SC HOURLY /TN ""My Task"" /TR ""'{app}\MyProg.exe' par1""";
This way the console window with an error message is preserved.
See Debugging non-working batch file or command executed from Inno Setup installer.
For uninstalling, see Delete Task Scheduler task at Uninstall?
Simply add the task scheduler command line entries to the [Run] section of your script. The entries in that section are executed after the program is successfully installed.