Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scripting TFS Command Line for Get Latest Version, Check Out and Check in, programmatically

I use WinXP, VS 2008 and Team Explorer to connect to Team Foundation Server.

I need to script (e.g. BAT file script) the following:

  • Get latest version of folder in Team Project.
  • Check out files of folder in Team Project.
  • Check in files of folder in Team Project.

My TFSProject is $/Arquitectura/Main/, mapped to the path C:\TFS\Arquitectura

Does anyone have any sample code or suggestions?

like image 863
Kiquenet Avatar asked Sep 21 '10 17:09

Kiquenet


People also ask

Where is TF EXE located?

The location of the tf.exe file, for example, C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE . The name of the TFS workspace. A workspace maps local and version-controlled folders on the TFS server.


2 Answers

Use tf.exe in the command line.

In the following examples, the %PathToIde% is usually on a path like this: %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE, or on Windows x64: %ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE (depending on Visual Studio version and installation settings).

Example for get:

cd C:\TFS\Arquitectura "%PathToIde%\TF.exe" get $/Arquitectura/Main /recursive 

Example for checkout:

cd C:\TFS\Arquitectura "%PathToIde%\TF.exe" checkout $/Arquitectura/Main /recursive 

Example for checkin:

cd C:\TFS\Arquitectura "%PathToIde%\TF.exe" checkin $/Arquitectura/Main /recursive 

See for more information on the tf commandline.

like image 124
Ewald Hofman Avatar answered Sep 25 '22 10:09

Ewald Hofman


Update for VS2017

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe'

like image 26
Mark Monforti Avatar answered Sep 25 '22 10:09

Mark Monforti