Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Setting installer property with per-user vs. per-machine

Wed Mar 19, 2014 8:04 pm

I've run in to a bit of a problem when setting an installer property value containing APPDIR using the Edit Control Event dialog:

Property: [CustomActionData]
Argument: cmd.exe /c reg add "hkcu\Environment" /v CATALINA_HOME /t reg_sz /d "[APPDIR]\" /f

When the custom action runs per-machine it sets CATALINA_HOME as

Code: Select all

C:\Program Files (x86)\<company>\<app>" /f
and per user as

Code: Select all

If I change the arugment to (remove the backslash after [APPDIR]): cmd.exe /c reg add "hkcu\Environment" /v CATALINA_HOME /t reg_sz /d "[APPDIR]" /f I get

Code: Select all

C:\Program Files (x86)\<company>\<app>

Code: Select all

C:\Users\<user>\AppData\Local\Programs\<company>\<app>" /f
The trailing backslash is being treated differently based on the selected installation type, so I can only get one installation working at a time. Is there an easy way to conditionally include the backslash in the Argument field or do I need to create two conditional values for the entire argument and populate an intermediate data value to use as the argument?

I've temporarily resolved this by duplicating the [CustomActionData] property and putting conditions on both copies.

- Adam

Return to “Common Problems”