Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

View Command

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

Required Permissions

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

tf view [/collection:TeamProjectCollectionUrl] [/console] [/recursive] [/output:localfile]
[/shelveset:shelvesetname[;owner]] [/noprompt] itemspec 
[/version:versionspec] [/login:username,[password]]

Argument

Description

TeamProjectCollectionUrl

The URL of the team project collection that contains a specific version of a file about which you want to retrieve information (for example, http://myserver:8080/tfs/DefaultCollection).

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.

NoteNote
You can specify more than one Itemspec argument.

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 (Version Control).

username

Provides a value to the /login option. You can specify a username value as either DOMAIN\UserName or UserName.

localfile

Provides the path of the folder to which you want to output the file.

Option

Description

/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 version control server version.

/collection

Specifies the team project collection.

/login

Specifies the user name and password to authenticate the user with Visual Studio Team Foundation Server.

/output

Outputs the file to a local folder instead of invoking a Windows shell to open the file.

The view command of the tf command-line utility retrieves a read-only copy of a file from the Team Foundation version 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 version 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 version control server version of and check out files.

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

For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.

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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft