Inno Setup, spaces in parameters in [Run] - inno-setup

I'm trying to create a setup with Inno Setup.
In the run section, I want to launch a bat with two parameters but in the first parameters, there is a path file and a space is potentially inside. How to avoid the problem?
I found this topic in vain...
Inno Setup, spaces and double quote in [Run]
Thanks for your help.
[Run]
Filename: {code:GetDirSQL|0}\installSQL\createBase\launchCreateParam.bat;
Parameters: {code:GetDirSQL|0}\installSQL\createBase {code:GetDossier|0};
Description: {cm:LaunchProgram,LumisTraiteur};
StatusMsg: Création de la base de données...; Check: instalDossier

See Parameters in Sections:
Parameters: """{code:GetDirSQL|0}\installSQL\createBase"" ""{code:GetDossier|0}"""
It may get more complicated, when the application, you are running, treats the quotes and spaces specially:
How to handle path with spaces in Inno Setup?
Inno Setup, spaces and double quote in [Run]

Related

How to have multiple Main Executable files with Inno Setup?

I am trying to package an office program in a setup file, and it has more than one (three to be be exact) main executables each which start your Word, Spreadsheet, and powerpoint software seperatly. Thanks
Inno Setup itself has no concept of the "main executable". This only appears in the wizard for simplification.
Once the script has been created, you can install as many [Files] or [Icons] as you want for every "main executable".

Renaming/replacing ShortCut During Inno Setup Installation

The [InstallDelete] Section enables files to be deleted but does not enable icons to be deleted (the only Type supported is files, I was hoping it also supported icons).
I need to change the shortcuts that are associated the programs being installed. I can add a new shortcut (e.g. 'Maintenance') by adding the appropriate parameters to the [Icons] section but have not found a way of removing the old shortcut (e.g. 'Repair').
Has anyone got any ideas how this can be acheived without delving into the Registry - I am familiar (but certainly not an expert) in the use of Pascal Scripting.
"Icon" aka Shortcut is just .lnk file placed somewhere - e.g. on your Desktop - pointing to other file - e.g. Program.exe - in {app} directory.
If you create such "icon" in [Icons] section it is automatically deleted during uninstall (unless the uninsneveruninstall Flag is set).
If you have some "icon" which you want to delete then simply delete the .lnk file from destination folder (e.g. Desktop).
You can do that in [InstallDelete] or [UninstallDelete] or programatically in [Code] section:
[InstallDelete]
Type: files; Name: "{commondesktop}\My Program.lnk"
where "{commondesktop}\My Program.lnk" is the path\name of the icon (actually the name of the .lnk file) to delete.

three components in three user defined locations

I saw this excellent article: Inno Setup - Correct use of [Types], [Components] and [Tasks] on components and types.
I currently have three separate setup.exe projects (iss) to install:
The program executable (default to: C:\ProgramFiles/ ) i.e. {pf}
a setup of js/css/html (default to: c:\wwwroot\sherlock
a setup to install image files (jpg/png) files (default to: c:\wwwroot\toby
I want the user it be able to redirect the default locations for each of these three "components" (i.e. perhaps his /wwwroot is on the G drive, or something like that. I don't see anyway in the Source: command other than to send this to {app}
Source: "Z:\EGPL Librarian Releases\Sample Installation\wwwroot\Sherlock\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Question: can this be done with components and types as the above article?
Should I rather create an installer of installer programs and keep the three separate setups? (And can you show me an example of an installer of installer programs?)
I am looking for a simple solution, since I have other work to do.
See this page. Note that it was written for an older version of Inno, but it should be easy enough to adapt.
Components/Tasks are for optional things. If your items are not optional then there's not much point in using them.
As for whether to make a single installer or an installer of installers -- the main question there is what you want to happen at uninstall time. If you want the user to be able to uninstall each part separately then you must create separate install scripts with unique AppIds (and then optionally make an installer of installers for them). If you want them to always be uninstalled together then you can make a single script.

How to create multiple setup applications with one .iss config?

Is it possible for one .iss file to produce different setup exes at the same time? maybe with multiple [Setup] sections?
It is not possible to create more than one output setup exe at the same time, but it is possible to create more than one from a single script.
The key is to use ISPP's #define and #ifdef or #if directives to designate parts of your script which are only compiled if specific variables are defined or given a particular value. You can then use a batch script to invoke iscc with the /dVAR or /dVAR="VALUE" parameters (which are the equivalent of a #define) to select different conditions for each compile.
This is only really useful if the scripts are largely the same, however (eg. if you want to make separate installers for different "editions" of an application, instead of including all files for the largest edition and deciding at runtime which to install). If your scripts are completely different from each other, then you should just create separate scripts and compile them from a batch file or an automated build script.
Test result:
By running a simple test... No, this is not possible. At first you can introduce sections on several places in a script. Consider you can do the following in your script:
[Setup]
AppName=My Program 1
AppVersion=1.5
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
[Setup]
DefaultDirName={pf}\My Program
From that you can see that compiler wouldn't recognize which one of the [Setup] sections belongs to which setup if you could write the script for more of them in one script file.
Workaround:
However, if you need to automate the build process on a basic level, you can create a batch file and run the compiler through the command line for all of your scripts. See the reference about command line compiler usage.
If you will compile several scripts with the same output directory, don't forget to specify different value of the OutputBaseFilename directive (the output exe name) for each script file.

Prevent a [Run] entry being processed with Inno Setup installer command line

I am running an installer that I built with Inno Setup, and I want to be able to control whether the applications runs or not after installation. I am using the [RUN] section to control this, but according the Inno docs, command line parameters can only control the [TASKS] section. Is there a way to enable/disable items in the [RUN] section from the command line?
Inno doesn't have an option to do this built in, but you can read the command line parameters and make use of the results in a Check: function on the [Run] entry.
In code, you can use the GetCmdTail, ParamCount and ParamStrfunctions, or the {param:} constant (but it isn't as good for a boolean option)

Resources