Command-Line Syntax (Team System)

The syntax for the tf.exe command-line utility.

tf command item [/options]

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

Documentation Conventions

[/Brackets] represent options that are not required to complete a command. Non-bracketed items represent 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 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 of a file that contains a comment you want to use. However, you cannot specify both a comment and a commentfile.

In syntax examples, italic 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, 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 at 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 the 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 about these commands, see Tf Command-Line Utility Commands.

How Team Foundation Parses Itemspecs and Versionspecs

Itemspec Paths

An itemspec, which is an abbreviation for item specification, is a set of one or more characters that Team Foundation resolves as an item or set of items that reference file system or UNC paths mapped to either a workspace or the version control server.

For all Team Foundation commands that accept an itemspec, you can specify either local file 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.

Note

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 underneath 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 one or more 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 last retrieved into your workspace with the get command.

T

Latest revision.

When you use the History, Difference, or Merge commands, you can specify a range of versions by separating the versions with a tilde (~). See the following examples of how to specify a range by separating versions with a tilde:

To view the history of the file Form1.cs for changeset 137 only.

Syntax Example: **tf history /version:**C137~C137

To get the difference between changesets C123 and C125 for the file form.cs.

Syntax Example: tf difference/versionC123~C125 form1.cs.

To merge all the versions from the first changeset through to changeset C125 into branch2.

Syntax Example: **tf merge/version:**C125 branch1 branch2.

See Also

Concepts

Informational Commands

Working with Version Control Shelvesets

Working with Version Control Changesets

Reference

Command-Line Options

Other Resources

Team Foundation Version Control Command-Line Reference

Tf Command-Line Utility Commands