How to determine branch name from batch file

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 18:25:05

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/10332269/how-to-determine-branch-name-from-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!