PowerShell 脚本中的 TFS 命令 [英] TFS commands in PowerShell script

查看:46
本文介绍了PowerShell 脚本中的 TFS 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用 1.0.0 版本编写的 Powershell 脚本.在这个现有的旧脚本中,我需要从 TFS 获取项目的最新代码的工具.我在机器上有 TFS 客户端,这让我可以使用 TFS 命令行.我创建了 TFS 命令行注释以从 TFS 获取最新信息.这些命令从命令 propmt 成功运行.

I have a Powershell script written in the version 1.0. In this existing old script I need the facility to get the latest code of a project from TFS. I have TFS client on the machine and that lets me use the TFS command line. I have created the TFS command line comments to get the latest from TFS. These commands run successfuly from the command propmt.

现在我需要在我的旧 poweshell 脚本中包含这些 TFS 命令.我需要知道这是否可行?如果是,那么如何.

Now the I need to include these TFS commands in my old poweshell script. I need to know if this is doable? If yes then how.

谢谢.

推荐答案

一种选择是运行 TF.exe 程序和 PowerShell 脚本中的必要参数,就像使用任何其他可执行文件一样:

One option is to run the TF.exe program with the necessary arguments from within your PowerShell script, as you would with any other executable:

PS> & "$env:ProgramFiles\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe" @("workspace", "/new", "WS1", "/noprompt", "/login:foo,bar", "/collection:baz/tfs")

或者您可以使用 TFS Power Tools 中包含的 TFS PowerShell cmdlet:

Or you could use the TFS PowerShell cmdlets included in the TFS Power Tools:

PS> Add-PSSnapin Microsoft.TeamFoundation.PowerShell 
PS> Get-TfsChangeset -Latest -Server "http://mytfsserver"

这篇关于PowerShell 脚本中的 TFS 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆