PowerShell TFS 列出在特定时间范围内添加的所有文件

PowerShell TFS list all files which have been added within a certain timeframe

我使用 Microsoft Team Foundation Server 2015 Power Tools。我知道要列出在时间范围内已删除的所有文件,我们可以这样做:

Get-TfsItemHistory "$/MyProject" -Version "D29/01/2010~D03/12/2019" -Recurse -IncludeItems '-Server tfs-server-name | Select-Object -Expand "Changes" | ' Where-Object { ($_.ChangeType -eq Microsoft.TeamFoundation.VersionControl.Client.ChangeType::Delete ) } | 'Select-TfsItem | Select-Object Path | Sort-Object Path

现在我想列出所有已添加的文件。根据 ChangeType Enumerator 中列出的类型,我尝试用 Microsoft.TeamFoundation.VersionControl.Client.ChangeType::Add 替换 Microsoft.TeamFoundation.VersionControl.Client.ChangeType::Delete 但它不起作用。

您可能需要 -band ChangeType,因为它是一个标志枚举并且可能包含多个标志。

$ChangeType =  Microsoft.TeamFoundation.VersionControl.Client.ChangeType::Delete
(($_.ChangeType -band $ChangeType) -eq $ChangeType)

如果在 Patrick 提到的 post 处进一步解释该过程: