Can I get “&&” or “-and” to work in PowerShell?

后端 未结 12 898
南笙
南笙 2020-11-29 17:33

&& is notoriously hard to search for on Google Search, but the best I\'ve found is this article which says to use -and.

Unfortunatel

12条回答
  •  借酒劲吻你
    2020-11-29 18:21

    It depends on the context, but here's an example of "-and" in action:

    get-childitem | where-object { $_.Name.StartsWith("f") -and $_.Length -gt 10kb }
    

    So that's getting all the files bigger than 10kb in a directory whose filename starts with "f".

提交回复
热议问题