Powershell 查找包含字符串的所有路径

Powershell 查找包含字符串的所有路径,powershell,path,windows-10,Powershell,Path,Windows 10,是否可以制作一个脚本来查找包含字符串的所有路径 我基本上想要的是*\path\to\file*有效的完整路径 如何在windows中执行此操作,甚至可以执行此操作???短版本: gci -path X:\start\here -r |?{ $_.FullName -match [regex]::escape("\path\to\file") }|%{$_.FullName} 以及详细版本: Get-ChildItem -Path X:\start\here -Recurse | Where

是否可以制作一个脚本来查找包含字符串的所有路径

我基本上想要的是*\path\to\file*有效的完整路径

如何在windows中执行此操作,甚至可以执行此操作???

短版本:

gci -path X:\start\here -r |?{ $_.FullName -match [regex]::escape("\path\to\file") }|%{$_.FullName}
以及详细版本:

Get-ChildItem -Path X:\start\here -Recurse |
  Where-Object {$_.FullName -match [regex]::escape("\path\to\file")} |
    ForEach-Object { $_.FullName }
样本输出(具有不同的路径)

简短版本:

gci -path X:\start\here -r |?{ $_.FullName -match [regex]::escape("\path\to\file") }|%{$_.FullName}
以及详细版本:

Get-ChildItem -Path X:\start\here -Recurse |
  Where-Object {$_.FullName -match [regex]::escape("\path\to\file")} |
    ForEach-Object { $_.FullName }
样本输出(具有不同的路径)


是的,你所要做的就是创建一个所有目录的列表并过滤它。这听起来有点奇怪,所以要实现?是的,你所要做的就是创建一个所有目录的列表并过滤它。这听起来有点奇怪,要完成吗?