This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Using Strings/Properties in the command-line args of a Custom Action
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2010
11:41 AM
Using Strings/Properties in the command-line args of a Custom Action
I need to install some third-party software (call it Foomatic) by running its installer.
So first I created a Feature named Foomatic. It has no Components, because the work will be done by a Custom Action. (By the way, if anyone can point out how to do this work in a Component instead I'm all ears!)
On the Support Files pane, I added all the Foomatic files to the Language Independent section. These files include Install.exe, some dlls, etc. As far as I can tell, Install.exe is a proprietary piece of software, not an MSI installer or anything like that.
I created a String named FOOMATIC_LICENSE_KEY that has the necessary value.
I created a "New EXE" Custom Action named InstallFoomatic, which I configured as follows:
When I try to run this the install fails with Error 1721. Logging with *xv reveals that the command line is not expanding the FOOMATIC_LICENSE_KEY variable, although it is resolving SUPPORTDIR correctly. I also tried creating a Property for the license key value, because that hopefully will let me hide the value in the log file, but that wasn't expanded either.
Can anyone explain what I am doing wrong?
So first I created a Feature named Foomatic. It has no Components, because the work will be done by a Custom Action. (By the way, if anyone can point out how to do this work in a Component instead I'm all ears!)
On the Support Files pane, I added all the Foomatic files to the Language Independent section. These files include Install.exe, some dlls, etc. As far as I can tell, Install.exe is a proprietary piece of software, not an MSI installer or anything like that.
I created a String named FOOMATIC_LICENSE_KEY that has the necessary value.
I created a "New EXE" Custom Action named InstallFoomatic, which I configured as follows:
- Working directory:
- Filename & Command line: "[SUPPORTDIR]\Install.exe" -license "{FOOMATIC_LICENSE_KEY}"
- Install Exec Sequence: After InstallFiles
- Install Exec Condition: &Foomatic = 3
- All other settings: default values
When I try to run this the install fails with Error 1721. Logging with *xv reveals that the command line is not expanding the FOOMATIC_LICENSE_KEY variable, although it is resolving SUPPORTDIR correctly. I also tried creating a Property for the license key value, because that hopefully will let me hide the value in the log file, but that wasn't expanded either.
Can anyone explain what I am doing wrong?
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2010
11:45 AM
The only difference I could see is that you surrounded the SUPPORTDIR with brackets, where you surrounded the other variable with accolades.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2010
11:58 AM
As I understand it, the square brackets are used for directories and the braces are used for strings and properties. At least, that's what the documentation shows...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2010
02:20 PM
I think I may understand what is going on. Since I'm dealing with deferred Custom Actions, there is a limited subset of items available when they execute (see the help topic "Accessing or Setting Windows Installer Properties Through Deferred, Commit, and Rollback Custom Actions"). It seems likely that I'm running afoul of this. The easiest way to deal with it is to hard-code the license key on the command line, and not attempt to use a String or a Property. I'd have to start writing InstallScript programs to make stose available, and I just don't have the time for that.
If I have overlooked something obvious, please let me know.
If I have overlooked something obvious, please let me know.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2010
05:46 PM
Actually, if you pass a property (using [PropName]) as an argument to an executable, the deferred-action considerations don't apply. It's only in code or a script (InstallScript, C, VBScript, etc.) that you need that CustomActionData handling.
The {String_ID} form applies only in the InstallShield environment. To pass a value into the command line, use [PropName] as you did earlier in the command.
The {String_ID} form applies only in the InstallShield environment. To pass a value into the command line, use [PropName] as you did earlier in the command.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 27, 2010
11:23 AM
Yippee, using square brackets works!
Only one problem left on this topic: even though I created a Property for the license key, and added it to MsiHiddenProperties, the actual value of the license key shows up in the expanded command line when logging with *xv. Ironically, the section of the log file that displays all the the Properties stars out the license key. Is this just an oversight in the product?
Only one problem left on this topic: even though I created a Property for the license key, and added it to MsiHiddenProperties, the actual value of the license key shows up in the expanded command line when logging with *xv. Ironically, the section of the log file that displays all the the Properties stars out the license key. Is this just an oversight in the product?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 27, 2010
01:43 PM
For one explanation, please see the MSI help topic "Preventing Confidential Information from Being Written into the Log File".
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 27, 2010
01:55 PM
Yes, reading that topic is how I learned about MsiHiddenProperties. This works when the Property is logged, but not when the Property is expanded in a command line. For example, consider the Custom Action that runs the Foomatic installer with the following command:
"[SUPPORTDIR]\Install.exe" -license "[FoomaticLicenseKey]"
The relevant parts of the log file (logged at level *xv) are:
As you can see, it's working correctly when the Properties are being listed, but not in the expanded command line. I strongly suspect this is a bug where placeholders are expanded in order to create the command line, and the result is simply logged. You'd have to keep track of both the real command line and a version suitable for logging.
"[SUPPORTDIR]\Install.exe" -license "[FoomaticLicenseKey]"
The relevant parts of the log file (logged at level *xv) are:
MSI (s) (C4:30) [12:41:39:076]: Executing op: CustomActionSchedule(Action=InstallFoomatic,ActionType=1058,,Target="C:\temp\{68BD0CE4-5EBE-4356-B0E1-5AFF0E43B853}\Install.exe" -license "topsecret",)
...
Property(S): FoomaticLicenseKey = **********
Property(S): MsiHiddenProperties = FoomaticLicenseKey
...
Property(S): FoomaticLicenseKey = **********
Property(S): MsiHiddenProperties = FoomaticLicenseKey
As you can see, it's working correctly when the Properties are being listed, but not in the expanded command line. I strongly suspect this is a bug where placeholders are expanded in order to create the command line, and the result is simply logged. You'd have to keep track of both the real command line and a version suitable for logging.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 27, 2010
02:12 PM
It seems not to be exposed in the custom action settings in the Installation Designer, but does the logging behavior change if you use the Direct Editor view to view the CustomAction table, and add 8192 (the "custom action hidden target" bit) to the value in the Type column? (Mentioned at the end of the list on "Preventing Confidential Information from Being Written into the Log File".)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 27, 2010
04:09 PM
You're absolutely right, adding 8192 to the Type value makes the entire expanded command line starred-out in the log file. It's a pity that the entire line is hidden rather than just the license key value, but it sure beats the alternative. Thanks very much for your help.
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)