We recommend using Visual Studio 2017

Filename-Parts Syntax


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Filename-Parts Syntax.

Filename-parts syntax in commands represents components of the first dependent filename (which may be an implied dependent). Filename components are the file's drive, path, base name, and extension as specified, not as it exists on disk. Use %s to represent the complete filename. Use %|[parts]F (a vertical bar character follows the percent symbol) to represent parts of the filename, where parts can be zero or more of the following letters, in any order.

No letterComplete name (same as %s)
fFile base name
eFile extension

For example, if the filename is c:\prog.exe:

  • %s will be c:\prog.exe

  • %|F will be c:\prog.exe

  • %|dF will be c

  • %|pF will be c:\

  • %|fF will be prog

  • %|eF will be exe

Commands in a Makefile