Need command to get a file from TFS without a workspace

前端 未结 1 1871
青春惊慌失措
青春惊慌失措 2020-12-29 07:15

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)

相关标签:
1条回答
  • 2020-12-29 07:49
    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
    
    0 讨论(0)
提交回复
热议问题