### 34.4.1 Specifying system commands

To specify a command (or a macro) to execute before or after a document is converted (and optionally compiled and/or archived):

[Automation]

; SystemStartCommand = command line to run at start of processing

; SystemWrapCommand = command line to run at end, before compiling

; and archiving

; SystemEndCommand = command line to run at end, after compiling

; and archiving

The value you assign to one of the System*Command keywords is an actual Windows system command, just as you would have typed it at a Windows command prompt. For example:

[Automation]

SystemEndCommand = copy /Y G:\MyProj\Done\*.xml D:\xml\backups

Assign only one command to each keyword; the command must be all one line. If you need multiple commands or multiple lines per keyword, see the following:

§34.4.5 Supplying system commands in a .bat file

§34.4.6 Supplying system commands in a macro.

When you assign a system command (or a macro) to a System*Command, Mif2Go generates one or more lines of code, each of which is a command to be run at a Windows command prompt. Mif2Go writes these lines to a .bat file named for the keyword, saves the file in your project directory, and causes Windows to execute the file.

Use backslashes in file paths

When you specify a file path in a system command, use “\” as the separator character. For example, suppose you want to make a backup copy of your book on another server before you run each conversion, and then copy your result files to another directory:

[Automation]

SystemStartCommand = copy <$$_prjpath>\*.fm x:\backup

SystemEndCommand = copy <$$_currpath>\*.htm \outcopy

Start commands work only when you convert

If your configuration file includes the following setting:

[Automation]

OnlyAuto = Yes

commands assigned to SystemWrapCommand and to SystemEndCommand are executed; however, commands assigned to SystemStartCommand are ignored. When you set OnlyAuto=Yes, you are deploying an existing set of output files, and you do not want that set disturbed; see §35.13 Postprocessing separately from converting.

| 34.4 Executing operating-system commands |  | 34.4.2 Including macros and variables in system commands |