TF Get Latest Version

Finally I managet to figure out the right syntax of getting the latest version of necessary folders from the Team Foundation Server using “TF”┬ácommand.

The script contains of 3 files:

  • “get.bat” (main entry point)
  • “enable tf cmd.bat” (enables TF command for current caller)
  • “get.tfc” (helper for GET command)

enable tf cmd.bat

@ECHO OFF
ECHO Enabling TF command...
ECHO.
CALL "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
ECHO.
ECHO TF command enabled

get.tfc

get "$/MyTeamProject/BRANCH_XXX/%1" /force /recursive /login:domainuser,password

get.bat

@ECHO OFF
CALL "enable tf cmd.bat"
ECHO Getting latest version...
tf @get.tfc "Folder1"
tf @get.tfc "Folder2"
ECHO.
ECHO Getting latest version completed