Export (0) Print
Expand All

View Command

The view command retrieves a specific version of a file to a temporary folder on your computer and displays it.


tf view [/server:servername] [/console] [/recursive] 
[/shelveset:shelvesetname[;owner]] [/noprompt] itemspec 
[/version:versionspec]

Parameters

Argument Description

servername

The user-provided value for the /server option. Example: teamserver2.

shelvesetname [:owner]

Identifies the shelveset. The optional owner argument is used to specify a shelveset that is not owned by the current user.

Itemspec

Identifies the file or folder to retrieve. For more information about how Team Foundation parses itemspecs to determine which items are within scope, see Command-Line Options.

Versionspec

Provides a value such as C3 for the /version option. For more information about how Team Foundation parses a version specification to determine which items are within its scope, see Command-Line Syntax.

Option Description

/server

Identifies the Team Foundation Server. This option is required if the command is invoked from a directory that is not mapped to a workspace.

/console

Specifies that the file output should be directed to the console. This is useful if you want to write the file out to disk using console redirection (with a different name or location than the versioned item).

/recursive

Views all items in the specified directory and any subdirectories.

/shelveset

Specifies the shelveset by name.

/noprompt

Specifies that Team Foundation should not prompt you before displaying each file when you include a wildcard in an itemspec that matches more than one file.

/version

Specifies the version of the file to open for viewing. If you omit this option, view retrieves the latest Team Foundation source control server version.

The view command of the tf command-line utility retrieves a read-only copy of a file from the Team Foundation source control server to a temporary folder on your computer and displays its contents. Unless you specify a particular version, Team Foundation retrieves the latest version of the file from the Team Foundation source control server.

The view command does not retrieve files into your workspace or check them out. See Get Command and Checkout and Edit Commands for more information about how to get the Team Foundation source control server version of and check out files.

You can use the Difference Commandto view the differences between two versions of a file.

Output Options

By default, Team Foundation displays the contents of the file in the viewer associated with its file type.

If you include the /console option, Team Foundation prints the contents of the file to the command console. Likewise, if Team Foundation cannot locate a viewer for the type of file you have specified, it prints the contents of the file to the command console.

Finally, you can redirect the contents of a file to standard out using | or > in order to save it in another file or pass it to another program for post-processing.

The following example displays the latest version of the file 314.c.

c:\projects>tf view 314.c

The following example displays the version of 314.c that was checked in with changeset 1999.

c:\projects>tf view /version:C1999 314.c

The following example retrieves version 5 of 314.c and writes it to the file 314.old.

c:\projects>tf view /version:5 314.c > 314.old

The following example displays the latest version of each file that matches the wildcard "*.cs".

c:\projects>tf view *.cs

To use the view command, you must have the Read permission set to Allow. For more information, see Team Foundation Server Permissions.

Community Additions

ADD
Show:
© 2014 Microsoft