37.1.1.3 Escaping special characters in macro definitions

Use a backslash in a macro to escape other characters, such as “\”, “<”, “>”, “"”, “$”, “;” and “ ” (space). For example, if you need to start a macro content line with “[” or “;” (left bracket or semicolon), preface the line with a backslash, to keep the line from being treated as a comment or section head:

[MyMacro]
\; This is not a configuration-file comment
; This is a configuration-file comment
\[NotTheNextSection]
[TheNextSection]

To specify a trailing space at the end of a macro, insert any of the following:

two spaces

(a backslash followed by a space)

\~ (a backslash followed by a tilde).

The \~ convention is especially helpful, because it allows you to show that a space is unequivocally intended.

Make sure to escape the backslash itself if your macro includes path names. For example:

[MyGraphicFileCopy]
cd <$$_currpath>\\wrap
copy "c:\\my graphics\\*.jpg"
copy "c:\\more graphics\\*.jpg"

To include a comment in macro definitions, see §37.1.1.5 Including comments in macro definitions.

Previous Topic:  37.1.1.2 Understanding where you can define named macros

Next Topic:  37.1.1.4 Managing line breaks in macro definitions

Parent Topic:  37.1.1 Defining macros

Sibling Topics:

37.1.1.1 Understanding what a macro definition can include

37.1.1.2 Understanding where you can define named macros

37.1.1.4 Managing line breaks in macro definitions

37.1.1.5 Including comments in macro definitions

37.1.1.6 Obtaining RTF code for macro definitions