如何为符号创建过滤器 - 在 PowerShell 中

How to make filter for symbol - in PowerShell

如何为符号创建过滤器 - 在 PowerShell 中

Get-ChildItem -Include *-* 

如果我的文件或文件夹的名称类似于

,则无法使用

Test1-DEV

测试2-测试

Test3-分期

使用-Path(默认参数):

Get-ChildItem -Path *-* 

或者,如果您在子目录中搜索,请结合使用 -Recurse 参数和 -Include

来自Get-Help Get-ChildItem

-Include <String[]>

Specifies, as a string array, an item or items that this cmdlet includes in the operation. The value of this
parameter qualifies the Path parameter. Enter a path element or pattern, such as *.txt. Wildcards are
permitted.

The Include parameter is effective only when the command includes the Recurse parameter or the path leads to
the contents of a directory, such as C:\Windows\*, where the wildcard character specifies the contents of the
C:\Windows directory.

Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Accept wildcard characters?  false