10.5 NMAKE Command File

If you find yourself repeatedly using the same sequence of command-line arguments, you can place them in a text file and pass the file's name as a command-line argument to NMAKE. NMAKE opens the command file and reads the arguments. This feature is especially useful if the argument list exceeds the maximum length of a command line (128 characters in DOS, 256 in OS/2).

To provide input to NMAKE with a command file, type

NMAKE @commandfile

In the commandfile field, enter the name of a file containing the information NMAKE expects on the command line. You can split input between the command line and a command file. Use the name of the command file (preceded by @) in place of the input information on the command line.

Example 1

Assume you have created a filenamed UPDATE containing this line:

/S "program = sample" sort.exe search.exe

If you start NMAKE with the command

NMAKE @update

then NMAKE reads its command-line arguments from UPDATE. The at sign (@) tells NMAKE to read arguments from the file. The effect is the same as if you typed the arguments directly on the command line:

NMAKE /S "program = sample" sort.exe search.exe

NMAKE treats the file as if it were a single set of arguments and replaces each line break with a space. Macro definitions that contain spaces must be enclosed in quotation marks, just as if you had typed them on the command line.

The quotation marks that delimit a macro force all characters between them to be interpreted literally. Therefore, if you split a macro between lines, an unwanted line break is inserted into the macro. Macros that span multiple lines must be continued by ending each line except the last with a backslash (\):

/S "program \

= sample" sort.exe search.exe

This file is equivalent to the first example. The backslash allows the macro definition ("program = sample") to span two lines.

Example 2

If the command-file UPDATE contains this line:

/S "program = sample" sort.exe

you can give NMAKE the same command-line input as in the example above by specifying the command

NMAKE @update search.exe