问题
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.
- From the DOS Shell go to the directory in your workspace where the branch is located (C:\tfs\Project\Branch1\Config\Deployment)
- Use the command :
TF.EXE info .
- 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