需要命令从没有工作区的 TFS 获取文件 [英] Need command to get a file from TFS without a workspace
本文介绍了需要命令从没有工作区的 TFS 获取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要做的是使用命令行(tf.exe 或 powershell)将特定版本的文件从 TFS 获取到工作区以外的位置
What I want to do is get a specific version of a file from TFS to a location other than my workspace using the command line (either tf.exe or powershell)
我想这样做是为了不影响我工作区中的文件,并将文件放入发布文件夹.
I want to do this so that it doesn't affect the files in my workspace, and places the file into a release folder.
tf.exe 似乎只支持获取文件到您的工作区.
tf.exe only seems to support getting a file to your workspace.
我也没有找到用 Powershell 做到这一点的方法.
I haven't found a way to do it with Powershell either.
有人可以帮我吗?
推荐答案
rem tf.exe
tf view $/path/to/file.txt /version:1234 > %temp%\file.txt
# powershell
$tfs = get-tfsserver $hostName -all
$tfs.vcs.DownloadFile($serverPath, $fileName)
# even better: manipulate entirely in-memory
$item = $tfs.vcs.GetItem($serverPath) # tons of GetItem(s) overloads available
$contents = ( [io.streamreader]$item.DownloadFile() ).ReadToEnd()
$contents | ? { some-condition } | do-coolstuff
这篇关于需要命令从没有工作区的 TFS 获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文