Equivalent of 'more' or 'less' command in Powershell?

后端 未结 12 2050
小蘑菇
小蘑菇 2020-12-13 01:38

Is there a way to paginate the output by piping it to some \'more\' command, which is available in linux\\unix shells?

12条回答
  •  情歌与酒
    2020-12-13 01:59

    The Powershell Community Extensions have a handy function named 'less' that provides a more complete Unix-style feature set, using a ported copy of less.exe to actually handle the paging.

    You can install it by starting an admin shell and running:

    Find-Package pscx | Install-Package -Force
    

    (the force is to upgrade older versions)

    You can pipe strings to it, or give filenames as direct parameters.

    type foo.txt | less
    less foo.txt, bar.txt, baz.txt
    

    It works in ConEmu and Powershell windows, but unfortunately it doesn't work the way you'd expect under the v2.0 ISE.

提交回复
热议问题