Equivalent of 'more' or 'less' command in Powershell?
Is there a way to paginate output by piping it to a more
or less
command, similar to those that are available in Linux\Unix shells?
Yes there is:
some-cmdlet | out-host -paging
Well... There is "more", which is more or less (...) the same you'd expect from other platforms. Try the following example:
dir -rec | more
dir -rec | more
is bad advice.
It will cause powershell to evaluate the entire command prior to outputting it to the screen, something that is not needed for something like output paginating
In some extreme cases, it could cause the system to crash (e.g. dir 'C:\' | more
)
On the other hand, using out-host -paging
will output information to the screen as it is available.