LINK.EXE Command Files

Where a directive on the actual command line begins with an @ sign, the remainder of the directive names a command file. It is a fatal error (LNK1104) if the command file cannot be opened for reading in text mode (with no sharer to have write access). The one exception is that the hyphen is interpreted as naming standard input, which the linker assumes is already open.

Though @- is supported syntactically and is explicitly provided with a non-trivial interpretation in the code, it is essentially useless. First, if standard input is a device, such as the console, then since the C Run-Time Library explicitly does not interpret Ctrl-Z as terminating input from a device, there seems to be no way to stop the linker from wanting to keep reading directives from standard input forever. Second, if standard input is redirected from a file, then because the linker does not open the file on each pass through its command-line sources, the file’s contents are good for only the first pass.

The command file is parsed for directives line by line, for as long as lines can be read. It is a fatal error (LNK1170) for a command file to have too long a line. The present limit is 128KB.

A command-file directive is in effect a command-line macro, expanding in place to whatever command-line arguments are found in the named file. Note however that command-file directives are recognised only on the actual command line. In all other circumstances, including recursion from a command file, a directive that begins with an @ is interpreted as an input-file directive, with the @ as the first character in the filename.