我对Powershell中的Where-object函数有一个问题。
Get-ChildItem "$CurrentPath\TEMP"当我尝试对name对象进行搜索时,结果如下:
Get-ChildItem "$CurrentPath\TEMP" | Where-Object {$_.Name -match "[Erai-raws] B"}"[]“字符一定有问题,如果我用这个进行同样的搜索,我会得到一个结果:
Get-ChildItem "$CurrentPath\TEMP" | Where-Object {$_.Name -match "[Erai-raws] "}如果知道我的搜索变量是: Erai-raws Boku no Hero学术第四季- 01 720p,您是否有解决方案允许我使用名称对象执行搜索
我已经尝试了like,with match,但是一旦我输入"[] *",就没有更多的"match“了……
谢谢
发布于 2021-01-10 23:47:57
不错,适用于正则表达式转义:)
Get-ChildItem "$CurrentPath\TEMP" | Where-Object {$_.Name -match [regex]::Escape("[Erai-raws] Boku no Hero Academia 4th Season - 01 [720p][Multiple Subtitle]")}感谢您的帮助和响应,主题锁定:)。
https://stackoverflow.com/questions/65655008
复制相似问题