在PowerShell中传递多个字符串以获取路径,但没有结果

在PowerShell中传递多个字符串以获取路径,但没有结果,powershell,powershell-2.0,Powershell,Powershell 2.0,我有以下代码: filter MultiSelect-String( [string[]]$Patterns ) { # Check the current item against all patterns. foreach($Pattern in $Patterns) { # If one of the patterns does not match, skip the item. $matched = @($_ | Select-Stri

我有以下代码:

filter MultiSelect-String( [string[]]$Patterns ) {

    # Check the current item against all patterns.
    foreach($Pattern in $Patterns) {

        # If one of the patterns does not match, skip the item.
        $matched = @($_ | Select-String -Pattern $Pattern)

        if(-not $matched) {
            return
        }
    }

    # If all patterns matched, pass the item through.
    $_
}

Get-ChildItem -recurse | MultiSelect-String 'v1','Produit','quota'| select -unique path
当我执行代码时,它应该给我路径+文件名(目录/文件名)

然而,它没有给我任何结果,但是当我执行相同的操作时,没有| select-unique path


它给我的结果对我来说是无用的。如何获取目录路径和文件名。有什么想法吗?

路径
不是
文件信息对象
的属性。改用
目录
全名

Get-ChildItem -recurse | MultiSelect-String 'v1','Produit','quota'| select -unique directory # for path or fullname for path\filenamt.ext

@很高兴能帮上忙!