如何为符号过滤 - 在PowerShell中

问题描述 投票:0回答:1

如何为符号过滤 - 在PowerShell中

Get-ChildItem -Include *-* 

如果我的文件或文件夹的名称是这样的,则不起作用

测试1-DEV

TEST2试验

TEST3分期

powershell wildcard
1个回答
4
投票

使用-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
© www.soinside.com 2019 - 2024. All rights reserved.