Hello Robert,
Please allow me to answer your inquires below:
1. Custom Action Input - it should get it from the command line as custom Properties obtained from command-line of msiexec.exe.
Yes, this is possible.
1.1 Custom Property passed to msiexec.exe command line.
msiexec.exe ... MYPROPERTY="MYVALUE"
The syntax of this is indeed correct.
Q.1.1 Should I register MYPROPERTY somewhere with "Advanced Installer"?
If you pass the property through the command line, then there isn't any need for you to do so. If you do not want to pass the property through the command line, then you can indeed define your property in Advanced Installer (
"Install Parameters" page -->
"Properties" section).
1.2 Custom Action gets it via command line.
Q.1.2 Is it something like the below in the command line area?
-a -b [MYPROPERTY]
Yes, this is possible. Let's have the following exmple:
We have the following application - Notepad/Notepad++
Notepad/Notepad++ can be run from the command line, as it follows:
<path_to_notepad++>\notepad++.exe --> it simply opens notepad++
<path_to_notepad++>notepad++.exe "path_to_some_txt_file" --> it opens a text file in notepad++
Let's say we want to pass the path to the .txt file through a property. If so, we could create a custom action as it follows:

- LaunchFile.png (64.76 KiB) Viewed 17401 times
After doing so, we can launch our .MSI file as it follows:

- cmd.png (60.6 KiB) Viewed 17401 times
This way, the notepad++.exe will be launched with the argument stored by our property.
1.3 Conditional run if [MYPROPERTY] value exists.
Q.1.3 Is there an option for a conditional run if MYPROPERTY was indeed passed to msiexec and and has non-empty value?
Yes, this is possible. To do so, please go to your custom action and enter the name of your property in the
"Condition" field, as it follows:

- condition.png (70.1 KiB) Viewed 17401 times
This way, the custom action will only be executed if the MY_PROP property exists.
Q.2 What are the options to either directly write to the log OR after the Custom Action to collect the return status
and thus translate it to the output to log?
This could be done in the following way:
- instead of using the predefined
"Launch File" custom action, you could use another custom action (e.g. PowerShell, VBScript, C#, etc.) which will launch your .EXE file, check its error code and then write the results to the log file.
For instance, the return code of an executable can be checked through the %errorlevel% environment variable. Here is how you can check the return code of notepad++ using a batch file:
1. create a text file and paste the following content to it:
Code: Select all
"C:\Program Files (x86)\Notepad++\notepad++.exe"
ECHO %errorlevel%
PAUSE
2. replace the path with the path on your machine
3. save it with the .bat extension
4. run it
This should bring back the return code of the process.
Hope this helps.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging