A.3.2.2 Accessing the Value of a Variable

As discussed earlier, the Setup program maintains a separate symbol table for storing the variables and their values for each shell section called. Consequently, different shell sections can use the same variable names without conflict. Any install section called by a shell section can access all the variables that have been defined in its shell section. Similarly, variables defined in an install section are available in the shell section, even after the install section has been exited. A shell section can use the exclamation point (!) operator to access variables that were defined by its shell section ancestors. When control returns from a shell section, the shell section’s symbol table is deleted.

Use the following syntax to access the value associated with a variable:

$([!]var)

When the Setup program is interpreting a line in an INF script, it replaces this with the value string associated with var. The optional ‘!’ operator enables accessing global variables (that is, variables defined in other shell sections, including sections in other INF files). The ‘!’ operator is useful in accessing the global variables defined in the INF scripts distributed with the Setup program, such as initial.inf.

Examples:

$(Option)        ; a local variable
$(!STF_NTPATH)   ; a global variable
 

Other operators for accessing variable values are described in the next section, INF operators.