Page 1 of 1

Escaping a dollar sign ($)

Posted: Tue Nov 21, 2006 3:46 pm
by tltaylor76
Is there a way to include a dollar sign in a variable name without causing the installer to die? I have tried putting a dollar sign in a variable and then using that variable and it still does not work...at run-time anyway. It does work when you go through the debugger.

We are installing different instances of a service, and to stay within the standards set by Microsoft, we would like to place a $ between the name and the instance. The is the same approach Microsoft takes with SQL Server.

Any help you could provide would be great. Thanks.

Posted: Tue Nov 21, 2006 5:55 pm
by MichaelNesmith
Are you saying that having a $ sign as part of a variable's value causes problems? That should work, and that should cover your requirement.

You can also use a single $ as a string literal for the $ sign. There is no need for escapes.

Variables are substituted only when an actual variable has been defined matching the pattern $VAR$, any other usage of the $ sign is also allowed.

Posted: Tue Nov 21, 2006 6:25 pm
by tltaylor76
The problem I am running into is this...I am setting a service name according to the instance of the installation. I would like my resulting name to look like this:

MYSERVER$MYINSTANCE

So when I set the name inside of the editor in InstallAware, I have it set like this:

MYSERVER$$INSTANCENAME$

Which didn't work. So I tried to create a variable to substitue the literal character:

Set Variable DOLLARSIGN to $

MYSERVER$DOLLARSIGN$$INSTANCENAME$

This compiles, but when you run the installation at run-time, it never gets through the initial loading sequence. It will work through a debug session though.

Posted: Tue Nov 21, 2006 6:39 pm
by MichaelNesmith
What happened with MYSERVER$$INSTANCENAME$?