Build Utility Command-Line Parameters

The Build command-line has the following syntax:

build [Switches] [Directories] 


  • Switches
    Each switch must be preceded by either a slash ('/') or hyphen ('-') character. However, if you are specifying a sequence of switches that do not have arguments, you can use a single slash or hyphen and no spaces. For example, build /c /Z /g can be shortened to build /cZg.

    The following is a complete list of command-line switches for the Build utility.

    Switch Effect


    Force _objects.mac to be regenerated.


    Pass 0 generation only. The build process will not compile and link through Pass 1 and Pass 2.


    Only do a two-pass build -- skip Pass 0. The build process will compile and link through Pass 1 and Pass 2.


    Same as /Z.


    Enable synchronized blocks and drains during link pass.


    Display full error message text without truncating anything.


    Delete all object files.


    Delete all .lib files.


    The same as /nmake clean.


    Check dependencies before building. Scans the source files, parses #include statements, checks the timestamps of header files, deletes out-of-date object files, and prevents running in directories that are up-to-date. Do not use with /Z.


    The Build utility includes any directory decorated with a type specified by the <type> argument. If the exclamation point (!) is used, the Build utility excludes any directory decorated with a type specified by the <type> argument.

    Directories are decorated with one or more types in the Dirs file through either the DIRS or OPTIONAL_DIRS macros.

    Valid types are Product, Test, and Tool.


    Generate the log, error, and warning files. (For more information, see Using Log Files.)


    Always keep the log files.


    When displaying errors/warnings to stdout, print the full path.


    Uses colored text when displaying warnings, errors, and summary text.


    Enable target-specific Dirs files only if there is just one target.


    Ignore extraneous compiler warning messages.


    Do not display thread index when you perform a multiprocessor build.


    Use Filename as the name for log files. Filename should not include the file name extension, although it may include a directory path. See Specifying the Location of Created Files for more information.

    /jpath Path

    Use Path as the directory for log files instead of using the current directory. See Specifying the Location of Created Files for more information.


    Keep out-of-date targets instead of deleting them.


    Link only. Do not perform any compilation.


    Compile only. Do not perform any linking.

    /M [Threads]

    Multiprocessor build. Without Threads, the /M switch causes Build to start one thread for each processor. If Threads is present, it specifies the exact number of threads to start. When /M is used without Threads on a single-processor computer. It has no effect.


    Background mode. Run the Build utility in the idle priority class.

    /nmake Arg

    Specifies the argument to pass to the NMAKE utility.


    Display out-of-date files.


    Generate obj\_objects.mac file for current directory.


    Pause before compile and link phases.


    Print elapsed time after every directory.


    Query only; do not run the NMAKE utility.

    /r Path

    Restarts a clean build at the specified path.


    Display a status line at the top of the display.


    Display a status line with header file line counts.


    Display the first level of the dependency tree.


    Display the complete dependency tree.


    Display all unused BUILD_OPTIONS.


    Display the complete dependency tree hierarchically.


    Enable header file version checking.


    Display warnings on screen.


    List reasons for building targets.

    /x Filename

    Excludes the specified header file from dependency checks.


    Displays all files scanned.

    /Z or /z

    Prevents dependency checking or scanning of source files. Compiles and links. Do not use with /D.


    Build targets for the x86 architecture.


    Same as /x86.


    Build targets for the Itanium architecture.


    Build targets for the x64-based architecture.


    Build targets for processors that use the ARM architecture. This processor is not supported by the Windows Driver Kit (WDK).


    Same as /x86 /ia64 /amd64 /arm.


    Display help text with a list of all command-line switches.


  • Directories
    This parameter is not preceded by a hyphen and is used to control the build of additional directories. One or more Directories parameters may be specified.

    This parameter uses the arguments shown in the following table.

    Argument Effect


    Build all optional source directories that are specified by the OPTIONAL_DIRS macro, which is specified within the Dirs file.


    Specify directories that are not to be built. All directories matching DirName will be excluded from the build. In addition, these directories must be listed in the Dirs file.

    ![Relative path\\DirName]

    Exclude only the specified directory from the build. The path given is relative to where the Build utility is started.




Send comments about this topic to Microsoft

Build date: 5/3/2011