Share via


Command-Line Syntax (Version Control)

The syntax for tf, a Team Foundation command-line utility, commands is as follows:

tf command item [/options]

This topic describes the documentation conventions, as well as command shortcuts, special command-line characters and the Team Foundation specific parameters, versionspec and itemspec.

Documentation Conventions

[/Brackets] denote options that are not required to complete a command. Non-bracketed items denote parameters that are required to complete the operation. For example, in the following command, itemspec is required and /recursive is optional:

Syntax Example: c:\projects>tf getitemspec [/recursive]

Actual Command: c:\projects>tf get c:\projects /recursive

Alternative Command: c:\projects>tf get /recursive

In the Alternative Command example, Team Foundation infers that you intend to get the contents of the current directory, c:\projects, and all of its subfolders. Therefore, even though the itemspec parameter is required, you do not necessarily have to type it.

When two, pipe (|)-separated options are enclosed by a set of brackets, you can specify either of, but not both of the options. For example, tf Changeset [/comment:comment|@commentfile] indicates that you can type a comment for a Changeset following the /comment: option or (|) you can use the **@**commentfile syntax to specify a path to a file that contains a comment you want to use. However, you cannot specify both a comment and a commentfile.

In syntax examples, italicized items are parameters that you must replace with actual characters to perform a command. Bold items are options that you include verbatim. For example:

Syntax Example: tf shelvesetsshelvesetname [/recursive]

Actual Command: c:\projects>tf shelvesets BuddyTest_23

Special Command Line Characters

You can use the "@" character, otherwise known as the command file switch, to perform a set of Team Foundation commands at the same time. The principal advantage of using a command line switch from the command prompt, a command file, or in a batch or script file is that using a command line switch can be much faster than performing individual commands. For more information, see Command-Line Options.

Command Shortcuts and Aliases

The following defined command shortcuts and aliases are supported for tf command-line utility:

  • del = delete

  • diff = difference

  • edit = checkout

  • hist = history

  • perm = permission

  • prop = properties

  • ren = rename

  • rename = move

  • stat = status

  • undel = undelete

For more information on the above commands, see Tf Command-Line Utility Commands.

How Team Foundation Parses Itemspecs and Versionspecs

Itemspec Paths

An itemspec, which is short for item specification, is a set of one or more characters that Team Foundation attempts to resolve as an addressable item or set of items, either on your computer or on the version control server.

For all Team Foundation commands that accept an itemspec, you can specify either local file system paths such as c:\projects or UNC paths such as \\myshare\projects or server paths such as $/projects/myfiles.

For local paths, you can provide relative paths. For example, if your current directory is c:\projects and you want to check out all items in a subdirectory of the projects folder, you can type tf checkout .\* /recursive.

Tip

You can use wildcard characters in Team Foundation version control commands, for example: * and ?.

If your itemspec specifies a server path, it must be fully-qualified. For example, you cannot check out all items beneath the $/projects folder using ./* as your itemspec.

Versionspecs

A versionspec specifies the version of an item that you want to work with. You can specify versions in a command either by including the versionspec as part of the version option (for example, /version:C1256) or by appending the versionspec to a file name with a semicolon (for example, filename;Lmylabel).

Use any of the following patterns to specify a version.

Versionspec

Description

Changeset

Version that belongs to changeset number changeset. Example: C1256.

Llabel

Version that belongs to the label label. Example: Lmylabel.

Dyyyy-mm-ddTxx:xx

—or—

Dmm/dd/yyyy

—or—

Any .NET Framework-supported format.

—or—

Any of the date formats for the local computer.

Any date and time format that could be parsed by a .NET Framework method.

Example: D2008-01-21T16:00.

For more information about supported date and time formats see DateTime Structure in the .NET Framework Class Library.

W

Version most recently downloaded into your workspace with the get command.

Wworkspacename;workspaceowner

Version most recently downloaded into the specified workspace with the get command.

Example: WResolveRIConflicts;AKerry

T

Most recent version.

When you use the History or Difference commands, you can specify a range of versions by separating the versions with a tilde (~).

See Also

Reference

Command-Line Options

Concepts

Informational Commands

Working with Shelvesets

Working with Changesets

Other Resources

Team Foundation Version Control Command-Line Reference

Tf Command-Line Utility Commands