# Variable expansion

**URL:** https://www.finalbuilder.com/forums/t/variable-expansion/2123
**Category:** Discussion
**Created:** [April 19, 2013, 1:01am UTC](https://www.finalbuilder.com/forums/t/variable-expansion/2123 "2013-04-19T01:01:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![markholbrook](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/markholbrook/32/134_2.png) [@markholbrook](https://www.finalbuilder.com/forums/u/markholbrook)
#### Post date: [April 19, 2013, 1:01am UTC](https://www.finalbuilder.com/forums/t/variable-expansion/2123/1 "2013-04-19T01:01:24Z")

</div>

Hello Vincent and others...

I've searched the forums and articles and found one on variable expansion.&nbsp; Currently I'm having an issue.&nbsp;&nbsp; I'm working on a FB7 script build 2183 that grabs a path string from a registry variable.&nbsp; The string contains things like:

$(BDS)\common; C:\Dev\Tools; $(DLCommon)\Library\source

The registry read function appears to get this just fine and I store it into a project variable.&nbsp; What I'm then trying to do is to check this registry string to see if it contains the items I need.

I have defined some project variables to contain thingslike:

%DLLibrary% = $(DLCommon)\Library\source

So I want to check if %DLLibrary% is in the read registry string.&nbsp; The problem I'm having is that FinalBuilder seems to be expanding even the $(var) references.&nbsp; So my registry variable which should contain:

$(BDS)\common; C:\Dev\Tools; $(DLCommon)\Library\source

Actually ends up looking something like:

C:\Program Files x86\embarcadero\RAD studio\9.0\common; C:\DevTools; C:\DLinkCommon\Library\source

In this case I really need to leave the $(var) values completely alone and not have them expanded because on one system $(BDS) points to path A and on another it might point to path B.

I read the article on variable expansion using %!var%.&nbsp; This works nicely for the %vars% but how in this case do I stop FB from expanding the $(vars)?

The $(vars) are for the most part environment variables and do show up in the variable list.&nbsp; In this case I'm working with the registry string as a string and I really don't want to expand anything in it.&nbsp; Is there some way to work with strings when they are stored in %var% and in all cases tell it NOT to expand anything in that %var%?

In my test case above I get expansion even if I so a simple string assignment.&nbsp; IE if I use the set var action and I do:

%myvar% = $(DLCommon)\Library\source

If I break and watch I see that %myvar% immediately has:

C:\DLinkCommon\Library\source

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [April 19, 2013, 1:38am UTC](https://www.finalbuilder.com/forums/t/variable-expansion/2123/2 "2013-04-19T01:38:02Z")

</div>

Hi Mark   
  
 By default FinalBuilder does recursive variable expansion. You can disable this by using a ! symbol in front of the name when referencing the variable, e.d   
  
 %!myvar%   
  
 [http://help.finalbuilder.com/variable\_evaluation\_and\_recurs.htm](http://help.finalbuilder.com/variable_evaluation_and_recurs.htm)
