|
1 | 1 | ---
|
2 | 2 | title: "CL Command Files"
|
3 |
| -ms.date: "11/04/2016" |
| 3 | +description: "The MSVC compiler lets you specify command files that contain command-line options." |
| 4 | +ms.date: 07/08/2020 |
4 | 5 | helpviewer_keywords: ["cl.exe compiler, command files", "command files", "command files, CL compiler"]
|
5 | 6 | ms.assetid: ec3cea06-2af0-4fe9-a94c-119c9d31b3a9
|
6 | 7 | ---
|
7 | 8 | # CL Command Files
|
8 | 9 |
|
9 |
| -A command file is a text file that contains options and filenames you would otherwise type on the [command line](compiler-command-line-syntax.md) or specify using the [CL environment variable](cl-environment-variables.md). CL accepts a compiler command file as an argument in the CL environment variable or on the command line. Unlike either the command line or the CL environment variable, a command file allows you to use multiple lines of options and filenames. |
| 10 | +A command file is a text file that contains compiler options and filenames. It supplies options you would otherwise type on the [command line](compiler-command-line-syntax.md), or specify using the [CL environment variable](cl-environment-variables.md). CL accepts a compiler command file as an argument, either in the CL environment variable, or on the command line. Unlike either the command line or the CL environment variable, you can use multiple lines of options and filenames in a command file. |
10 | 11 |
|
11 |
| -Options and filenames in a command file are processed according to the location of a command filename within the CL environment variable or on the command line. However, if the /link option appears in the command file, all options on the rest of the line are passed to the linker. Options in subsequent lines in the command file and options on the command line after the command file invocation are still accepted as compiler options. For more information on how the order of options affects their interpretation, see [Order of CL Options](order-of-cl-options.md). |
| 12 | +Options and filenames in a command file are processed when a command filename appears within the CL environment variable or on the command line. However, if the **`/link`** option appears in the command file, all options on the rest of the line are passed to the linker. Options in later lines in the command file, and options on the command line after the command file invocation, are still accepted as compiler options. For more information on how the order of options affects their interpretation, see [Order of CL Options](order-of-cl-options.md). |
12 | 13 |
|
13 |
| -A command file must not contain the CL command. Each option must begin and end on the same line; you cannot use the backslash (**\\**) to combine an option across two lines. |
| 14 | +A command file must not contain the CL command. Each option must begin and end on the same line; you can't use the backslash (**`\`**) to combine an option across two lines. |
14 | 15 |
|
15 |
| -A command file is specified by an at sign (**\@**) followed by a filename; the filename can specify an absolute or relative path. |
| 16 | +A command file is specified by an at sign (**`@`**) followed by a filename. The filename can specify an absolute or relative path. |
16 | 17 |
|
17 | 18 | For example, if the following command is in a file named RESP:
|
18 | 19 |
|
19 |
| -``` |
20 |
| -/Og /link LIBC.LIB |
| 20 | +```cmd |
| 21 | +/Ot /link LIBC.LIB |
21 | 22 | ```
|
22 | 23 |
|
23 | 24 | and you specify the following CL command:
|
24 | 25 |
|
25 |
| -``` |
| 26 | +```cmd |
26 | 27 | CL /Ob2 @RESP MYAPP.C
|
27 | 28 | ```
|
28 | 29 |
|
29 | 30 | the command to CL is as follows:
|
30 | 31 |
|
31 |
| -``` |
32 |
| -CL /Ob2 /Og MYAPP.C /link LIBC.LIB |
| 32 | +```cmd |
| 33 | +CL /Ob2 /Ot MYAPP.C /link LIBC.LIB |
33 | 34 | ```
|
34 | 35 |
|
35 |
| -Note that the command line and the command-file commands are effectively combined. |
| 36 | +Here you can see how the command line and the command-file commands are effectively combined. |
36 | 37 |
|
37 | 38 | ## See also
|
38 | 39 |
|
39 |
| -[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md)<br/> |
40 |
| -[MSVC Compiler Options](compiler-options.md) |
| 40 | +[MSVC compiler command-line syntax](compiler-command-line-syntax.md)<br/> |
| 41 | +[MSVC compiler options](compiler-options.md) |
0 commit comments