The syntax for tf, a Team Foundation command-line utility, commands is as follows:
This topic describes the documentation conventions, as well as command shortcuts, special command-line characters and the Team Foundation specific parameters, versionspec and itemspec.
[/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:
c:\projects>``tf get`` itemspec
c:\projects>``tf get`` c:\projects /recursive
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:
tf shelvesets`` shelvesetname
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
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 source 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.
You can use wildcard characters in Team Foundation source 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.
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.
Version that belongs to changeset number changeset. Example: C1256.
Version that belongs to the label label. Example: Lmylabel.
Any .Net Framework-supported format.
Any of the date formats of the local machine.
Any date and time format that could be parsed by a .NET Framework method. Example: D10/23/2005.
Version last fetched into your workspace with the get command.
When you use the History or Difference commands, you can specify a range of versions by separating the versions with a tilde (~).