#### 43.1.5 Supplying system commands in a macro

You can put system commands in a DITA2Go macro. A macro consists of a special configuration-file section to which you give a unique name; you invoke the macro by assigning its name, enclosed in <$ >, to a System*Command keyword. See §37.1 Defining and invoking macros.

For example, suppose your workflow requires backing up your DITA files to two servers. You could define a macro to supply the two copy commands, and assign that macro to a system command:

    [Automation]
    SystemStartCommand = <$backup>

    [backup]
    copy <$$_currpath>\\*.dita x:\\backup
    copy <$$_currpath>\\*.dita "y:\\my other\\backup"

Notice the doubled backslashes (required in DITA2Go macros, where backslash is used as an escape character), and the quotes around the path that includes a space. See §37.1.1 Defining macros.

Comment out commands in macros

To omit running a particular system command without actually deleting the macro line that executes the command, you can “comment out” the command by preceding it with a semicolon. For example, suppose you do not always want to create a second backup:

    [backup]
    copy <$$_currpath>\\*.dita x:\\backup
    ; copy <$$_currpath>\\*.dita "y:\\my other\\backup"

Previous Topic: 43.1.4 Supplying system commands in a .bat file

Next Topic: 43.2 Converting autonumbers for database systems

Parent Topic: 43.1 Executing operating-system commands

Sibling Topics:

43.1.1 Specifying system commands

43.1.2 Including macros and variables in system commands

43.1.3 Monitoring system command execution

43.1.4 Supplying system commands in a .bat file