Edit

Share via


basename NMAKE function

Gets the base name for each item in a list.

Syntax

$(basename input)

Parameters

input
The list of file paths to convert.

Return value

A list with each of the items from input converted to their base name (that is, with their extensions removed).

Remarks

basename doesn't have any maximum path limitations.

The basename function is equivalent to using the R modifier in a filename macro.

This macro function is available starting in Visual Studio 2022 version 17.1, in NMAKE version 14.31 or later.

Example

$(basename c:\temp\file.txt) # Evaluates to "c:\temp\file"
$(basename c:\temp\ c:\file) # Evaluates to "c:\temp\ c:\file" - Directories and files without extensions are left as-is
$(basename c:\src\.gitignore) # Evaluates to "c:\src\" - Dot files are considered to be extensions and so are removed

See also

Macros and NMAKE
NMAKE functions by category