Question

I did a get latest from TFS. My local path is:

C:\tfs\Project\Branch1\Config\Deployment\CopyInstallers.bat

TFS Path is:

$\Project\Branch1\Config\Deployment\CopyInstallers.bat

CopyInstallers.bat gets latest of installer folder from the branch at different location on the server and zips them and puts it on the shared location on server.

I have another branch named Branch2 and its TFS path is

$\Project\Branch2\Config\Deployment\CopyInstallers.bat

What I am trying is try to get the branch name using TF.exe or TFPT.exe, so that I should not har code the branch name in the CopyInstaller.bat file to get latest of installer folder.

Or is there any other way by which I can get to know the branch name / path with in the batch file?

Was it helpful?

Solution

Use the TF.EXE info command.

  1. From the DOS Shell go to the directory in your workspace where the branch is located (C:\tfs\Project\Branch1\Config\Deployment)
  2. Use the command : TF.EXE info .
  3. Parse the result on the "Server Path:" line.

EDIT : With Visual Studio 2010 replace the info command by the properties one

EDIT 2

Ok: I made you a console app, get the zip file here, there's the sources code and build exe.

Tell me if it's what you expected

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top