Variables

Top  Previous  Next

 

Variables can be used in all script sections.

 

Global Variables

 

If you declare Variables in the Setup section they are global in nature, so available in any part of the script.

 

Local Variables

 

If you declare Variables in the Notification or User Sections they are only available in that particular section.

 

So, for example, if you have a set of variables used to specify credentials for an FTP Upload you can keep those in the current User Section but define the same variable names with different values in a subsequent User Section to upload to a different FTP server.

 

Defining Variables

 

Variables are defined using the Var Command. Once defined you use them in the script by typing in the variable name surrounded with percent symbol pairs. For example:

 

[Setup]

Var:TestRoot=C:\Test

 

[Clean Up Old Files]

DeleteFile:%%TestRoot%%\TestFile.txt

lamp Note: There are many predefined variables known as Constant Expressions which provide access to things like date and time values and folder locations. These do not have to be defined but can be used at will without restriction.

Special Functions

 

There are a number of Special Functions that can be used to assign calculated values to a variable.

 

See Also: Special Functions Constant Expressions Script Sections Commands