Как сделать фильтр для символа - в PowerShell - PullRequest
0 голосов
/ 30 августа 2018

Как сделать фильтр для символа - в PowerShell

Get-ChildItem -Include *-* 

не работает, если мои файлы или папки имеют такие имена, как

Test1-DEV

Test2-Test

Test3-Балетмейстер

1 Ответ

0 голосов
/ 30 августа 2018

Использовать -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
...