共用方式為


Command-Line Syntax (Team Explorer Everywhere)

Now you’ve installed Cross-platform Command-Line Client for Team Foundation Server. But before you type any command, you’ll need to understand the general syntax and usage information.

In this topic

Specifying options

On UNIX computers, absolute paths start with a forward slash (/), so you use a hyphen (-) to start options. Otherwise, the Cross-platform Command-Line Client for Team Foundation Server cannot tell a path from an option.

Quoting and escaping

Unix shells support many special characters for wildcards, regular expressions, and so on. If those arguments contain characters that your shell considers special, you have to escape or quote arguments to commands. You can mark literal text in Unix shells as shown here:

  • To preserve the literal value of the character, precede it with a backslash (\). For example,

    tf checkout -recursive $/Inventory/Client\ Suite/
    
  • To preserve the literal values of the enclosed characters, enclose text within single quotation marks (‘’). Shell variables that are referenced with a dollar sign ($) and wildcards are not expanded if they are enclosed within single quotation marks. For example,

    tf checkout -recursive ‘$/Inventory/Client Suite/’
    
  • To preserve the literal value of the enclosed characters (with the exception of $, `, \, and !), enclose text within double quotation marks (“”).

    Because of these exceptions, variables are expanded, subshells are still evaluated, the backslash can still be used to escape characters, and history events are still expanded. The following example shows that a backslash is still required to prevent ! from being expanded into a history event.

    tf checkin -comment:”Fixed the bug\!” file.java
    

Server paths for Visual Studio Team Foundation Server start with a dollar sign, but Unix shells use the dollar sign to start variable expansion. Shells like sh, ksh, bash, and zsh recognize that the character in a server path that occurs after the dollar sign is not a valid variable name. Therefore, these shells pass the dollar sign to the Cross-platform Command-Line Client for Team Foundation Server unaltered.

However, shells derived from csh (including tcsh) do not parse the command line in this manner. These shells read the dollar sign and attempt to substitute a variable that matches the text that follows. Because the text that follows is a slash (/), and these shells require variable names to start with a letter, an error appears. If you use the csh or tcsh shells, you must escape the dollar signs in server paths by using a backslash or single quotation marks. Double-quotes cause the shell to try to expand the variable. Here are a few escaping and quoting examples for csh shells:

tf checkout -recursive \$/Inventory/Client\ Suite/

tf checkout -recursive ‘$/Inventory/Client Suite/’

tf checkout -recursive \$”/Inventory/Client Suite/”

Item specifications

An item specification is a local or server path that describes a file or folder that is an input parameter to an option or command for the Cross-platform Command-Line Client for Team Foundation Server. An item specification might contain a version specification suffix, separated by a semicolon. This suffix is optional. Specify the suffix only when you want to refer to a historic version of an item.

Example item specifications:

Item specification

Description

$/Inventory/src

Server path to a folder

$/Inventory/src/Class.java

Server path to a file

/tmp/Inventory

Local path (Unix) to a working folder

/tmp/Inventory/src/Class.java

Local path (Unix) to a file

C:\Inventory\src

Local path (Windows) to a working folder

C:\Inventory\src\Class.java

Local path (Windows) to a file

$/Inventory/src;C4095

Server path to a folder at changeset 4095

.\Class.java;C129

Relative local path (Windows) to a file at changeset 129

./Class.java;Lrelease-1.0

Relative local path (Unix) to a file at label release-1.0

$/Inventory/src/file.txt;Wdev;john

Server path at the version in the dev workspace that is owned by John.

file.txt;D01/01/2007

Local path at January 1, 2007

Note

ISO 8601 dates are supported. Dates are parsed according to the user’s locale.

file.txt;X1067

Previously deleted file with deletionID 1067

Version specifications

A version specification is a specially formatted string that refers to a specific single version or a range of versions of an item in version control. Version specifications are used in two ways: as suffixes to item specifications (see Item Specifications earlier in this topic) and as stand-alone values to the -version option for certain commands.

Example version specifications:

Version Specification Format

Description

T

The latest version.

Cn

The version at changeset n.

LlabelID

The version at label labelID.

Wname; owner

The version currently in workspace name owned by owner.

Ddatestring

The version at the date and time specified in datestring

XdeletionID

The version that was deleted and given the deletionID by the server.

See Also

Other Resources

Command-line Reference