2

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?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341

1 Answers1

2

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

Nock
  • 6,561
  • 1
  • 28
  • 27
  • There is not such command as "info" on the TF.exe Even tried using TFPT.exe (Powertool) and it also doesnot have it. – Dot_Refresh Apr 26 '12 at 13:02
  • Argh, you're right, it's a new command of Visual Studio 11. It doesn't exist for Visual Studio 2010. I look for another way. – Nock Apr 26 '12 at 13:36
  • Properties command does return the Server Path String, but the main question is how to identify the branch name. THanks but I am looking for a way by which i can get directly the branch name / path to which the file belongs to. – Dot_Refresh Apr 26 '12 at 15:16
  • If you know the location on your workspace of the Branch then use this command to retrive the server path the last directory will be the branch name, right ? For me the Branch name is the name of the folder, I can't see something else, can you be more explicit ? – Nock Apr 26 '12 at 15:37
  • In the above example path $\Project\Branch1\Config\Deployment\CopyInstallers.bat "Branch1" is my Development branch. This is the name OR $\Project\Branch1 path which i want to be able to retrieve by using a command. – Dot_Refresh Apr 26 '12 at 15:40
  • Hang on I'll make you a small app for that. You use a TFS 2010 or TFSPreview.com ? – Nock Apr 26 '12 at 15:50
  • I use TFS 2010 and TFS PowerTools – Dot_Refresh Apr 26 '12 at 16:05
  • Have you tested the Console App I made? – Nock Jun 01 '12 at 20:44
  • Sorry Nock, was away for very long time and not bound to the respective project. It worked for me. – Dot_Refresh Jun 12 '12 at 14:05