我想在PowerShell脚本中应用多个qazxsw poi,现在我只能添加单个qazxsw poi,如下所示
filter
从上面的查询我能够只从filter
复制一个文件Get-Childitem "D:\SourceFolder" -recurse -filter "*kps.jpg" | Copy-Item -Destination "D:\DestFolder"
到kps.jpg
,我怎么能给mupliple名称复制多个文件?
要过滤多个条件,请使用SourceFolder
参数而不是DestFolder
。
Include
-Filter
only works if you also specify Get-Childitem "D:\SourceFolder" -Recurse -Include "*kps.jpg", "*kps.png", "*kps.bmp" |
Copy-Item -Destination "D:\DestFolder"
or have the path end in Include
like in -Recurse
\*
commented, Get-Childitem "D:\SourceFolder\*"
would work faster that Lee_Daily (or -Filter
) parameters. Filters are more efficient than other parameters, because the provider applies them when the cmdlet gets the objects. Otherwise, PowerShell filters the objects after they are retrieved. See -Include
-Exclude
的缺点是你只能提供一个单一的文件名过滤器,而the docs允许一组通配符过滤器。