Escape Sequences

InstallShield 2015 » InstallScript Language Reference

An escape sequence is a set of characters used to insert into a string certain special characters—such as tabs, carriage returns and quotation marks. Escape sequences in InstallScript are very much like those in C. They begin with a backslash, called an escape character, and the backslash is followed by one or more characters that have special meaning. If the backslash is followed by characters other than those used in an escape sequence, the backslash is ignored.

Inserting a Newline Character Into a String

A commonly used escape sequence is \n, which inserts a newline character into a string. The string “This is line one, This is line two.” is displayed or printed on a single line. However, the string “This is line one,\nThis is line two.” is displayed or printed as shown below:

This is line one,

This is line two.

Note: The \n escape sequence works only in multiline static text fields. For example, you can insert \n in the szQuestion argument of AskText to manually format the string. You can also use \n with MessageBox and SprintfBox.

The newline escape sequence is case sensitive; that is, \N does not insert a newline character.

The percent sign (%) also has a special function in InstallScript; it is used as the first character of a format specifier, which is a sequence of characters that is used with functions such as Sprintf and SprintBox to indicate how the value stored in a variable should be displayed on screen.

Supported Escape Sequences

The following table lists the escape sequences that are supported by InstallScript:

Supported Escape Sequences

Escape Sequence

Performs the Following Action

\n

Inserts a line feed.

\'

Inserts a single quotation mark in the string.

\"

Inserts a double quotation mark in the string.

\r

Inserts a carriage return only. Does not insert a line feed.

\t

Inserts a tab character.

\ooo

Indicates an ASCII character—not an integer—in octal notation.

\\

Inserts a backslash.

Specifying a Universal Naming Convention Path

To specify a Universal Naming Convention (UNC) path in an InstallScript string, you must use two backslash escape sequences (that is, four backslashes—\\\\), to create the double backslash at the start of the path. For example, the path \\MyServer\Public\Readme.txt must be specified as follows:

"\\\\MyServer\\Public\\Readme.txt"