Inno Setup: Disable desktop icon and autostart entry via command line parameter - inno-setup

I'm creating an desktop icon and an autostart entry with an Inno Setup script like this:
[Icons]
Name: "{commonstartup}\abc"; Filename: "{app}\xyz.exe"; WorkingDir: "{app}"; Flags: createonlyiffileexists; Tasks: StartMenuEntry
Name: "{commondesktop}\abc"; Filename: "{app}\xyz.exe"; WorkingDir: "{app}"; IconIndex: 0; Tasks: desktopicon
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
Name: "StartMenuEntry"; Description: "{cm:AutoStartProgram}"; GroupDescription: "{cm:AutoStartProgramGroupDescription}"
Some users want to run my setup.exe from the command line. They want to add a parameter for silent installation /VERYSILENT and a parameter for disabling the desktop icon and the autostart entry.
Is that possible with a command line parameter? If not: What else is possible to do that? Thanks!

Use /TASKS or better /MERGETASKS command-line switches to alter the default task selection.
Particularly, to disable particular task, use /MERGETASK=!taskname:
mysetup.exe /VERYSILENT /MERGETASKS=!desktopicon,!StartMenuEntry
Related question: Command line switch to prevent Inno Setup installer from creating desktop Icon

Related

Create desktop link Icon after the Run section of Inno Setup

Overview
My install process involves placing over 2GB of data on a disk. So I use Inno Setup, but I run 7ZIP to actually extract/install the files.
Issue
The issue I have is that it seems the desktop icon is being created before the [Run] section, so there is no icon to set the the desktop link. Is there a way around this? (I have tried both {src} and {app} as the folder to find the icon.)
CODE
[Run]
Filename: "{pf64}\7-zip\7zG.exe"; Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
Flags: runascurrentuser
[Icons]
Name: "{group}\EGPL Watson Uninstall"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
Name: "{commondesktop}\DashBoard"; \
Filename: "{app}\dashboard\node_modules\electron\dist\electron.exe"; \
WorkingDir: "{app}\dashboard"; IconFilename: "{src}\dashboard\build\configure.ico"; \
Parameters: "main.js"; AfterInstall: SetElevationBit('{commondesktop}\DashBoard.lnk')
A quick and dirty solution is to set ChangesAssociations:
[Setup]
ChangesAssociations=yes
It makes Windows Explorer refresh all icons after the installer finishes.
A clean solution is to create the icon only after the [Run] section using CreateShellLink:
[Run]
Filename: "{pf64}\7-zip\7zG.exe"; \
Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
Flags: runascurrentuser; AfterInstall: CreateIcon
[Code]
procedure CreateIcon;
var
IconFileName: string;
begin
IconFileName := ExpandConstant('{commondesktop}\DashBoard.lnk');
CreateShellLink(
IconFileName, '',
ExpandConstant('{app}\dashboard\node_modules\electron\dist\electron.exe'),
'main.js', ExpandConstant('{app}\dashboard'),
ExpandContant('{app}\dashboard\build\configure.ico'), 0, SW_SHOWNORMAL);
SetElevationBit(IconFileName);
end;

Inno Setup doesn't create a scheduled task

My installer should install a Windows scheduled task for the application. The task definition is provided in an XML file. Installing the XML task file interactively works fine. But the installer doesn't install the task. Since I don't see its output, I don't know whether an error message is displayed. Windows event log doesn't contain anything.
The Inno Setup task "InstallAutostart" is checked so this should be executed. The files are copied to the installation directory.
Here's the script:
[Run]
Filename: "schtasks.exe"; Parameters: "/create /tn TClockAutostart /xml ""{app}\StartTClock.xml"""; WorkingDir: "{app}"; Description: "Install task for safe automatic start"; Tasks: InstallAutostart; Check: Not IsWin64
Filename: "schtasks.exe"; Parameters: "/create /tn TClockAutostart /xml ""{app}\StartTClock64.xml"""; WorkingDir: "{app}"; Description: "Install task for safe automatic start"; Tasks: InstallAutostart; Check: IsWin64
What's wrong here? How can I debug this?

InnoSetup: How can you set the order of icons in the start menu?

I have the following [Icons] section in my Inno Setup script:
[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\IA_Desktop.exe"; WorkingDir: {app}
Name: "{group}\{#MyAppName}"; Filename: "{app}\IA_Desktop.exe"; WorkingDir: {app}
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}
I would expect that the order of the icons in the Start Menu -> group would be:
MyAppName
MyAppUrl
Uninstall
But instead I get:
MyAppUrl
Uninstall
MyAppName
What settings or other code do I need to use to set the order of the icons in the group?
Thanks!

InnoSetup setting up desktop shortcut for node-webkit apps

I am setting up an installer for node-webkit desktop app. I have successfully created an app shortcut but I can't create a desktop shortcut because it requires an exe file. I am passing working directory reference to nw.exe in shortcut it works fine but there seems no option for creating a custom desktop icon. Here is my inno setup config file:
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}/node-webkit/nw.exe" ; Parameters: "."; WorkingDir: "{app}"; IconFilename: "{app}\{#MyAppIcon}"
Following code creates a desktop shortcut. Is there any way I can pass above icon reference to desktop icon?
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Here is the answer if anyone is looking for a solution. Thanks TLama.
[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "your.exe" ; Parameters: "."; WorkingDir: "{app}"; IconFilename: "{app}\{#MyAppIcon}"; Tasks: desktopicon
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";

Run application after successful install

How to make check box that allow user to run application after installation?
There you go:
under [Run]:
Filename: {app}\{cm:AppName}.exe; Description: {cm:LaunchProgram,{cm:AppName}}; Flags: nowait postinstall skipifsilent
under [CustomMessages]:
AppName=mySoftwaresNiceName
LaunchProgram=Start mySoftware after finishing installation
Check the postinstall flag in the [Run] section, see the documentation at https://jrsoftware.org/ishelp/topic_runsection.htm#postinstall
Add Filename to Run Section with Flag postinstall.
Example for Copy&Paste:
[Run]
// User selected... these files are shown for launch after everything is done
Filename: {app}\README.TXT; Description: View the README file; Flags: postinstall shellexec skipifsilent
Filename: {app}\APP.EXE; Description: Run Application; Flags: postinstall nowait skipifsilent unchecked
To make the checkbox, create a task:
[Tasks]
Name: StartAfterInstall; Description: Run application after install
and bind it to "run" action:
[Run]
Filename: {app}\{#exe}; Flags: shellexec skipifsilent nowait; Tasks: StartAfterInstall
where {#exe} is the name of exe-file

Resources