Tf变更集最新的不同登录

时间:2012-02-02 14:27:16

标签: powershell tfs psexec changeset

我想从powershell获取最新的变更集。我可以用

做到这一点
$changesetText= tf changeset /latest /server:${TFSServer} |out-string 

但这需要访问整个Team Project Collection,因为变更集编号用于所有分支。有什么办法可以用/登录吗?

1 个答案:

答案 0 :(得分:2)

psexec确实有效:

$changesetText= psexec -u ${username} -p ${password} tf changeset /latest /server:${TFSServer} |out-string

$changeset= "Changeset:"
$user= "User: "
$changeset_len=$changeset.length 

$newChangeset= $changesetText.Substring($changesetText.IndexOf($changeset) + $changeset_len, $changesetText.IndexOf($user) - $changesetText.IndexOf($changeset)- $changeset_len-1)
write-host "Last changeset number is : " $newChangeset