PowerShell: how to grep command output?

前端 未结 7 1320
温柔的废话
温柔的废话 2021-01-30 08:27

In PowerShell I have tried:

alias | select-string Alias

This fails even though Alias is clearly in the output. I know this is beca

7条回答
  •  有刺的猬
    2021-01-30 08:40

    PS> alias | Where-Object {$_.Definition -match 'alias'}
    
    CommandType     Name                   Definition
    -----------     ----                   ----------
    Alias           epal                   Export-Alias
    Alias           gal                    Get-Alias
    Alias           ipal                   Import-Alias
    Alias           nal                    New-Alias
    Alias           sal                    Set-Alias
    

    what would be contradict of match in PS then as in to get field not matching a certain value in a column

提交回复
热议问题