"More" Can Be Dangerous – Use Better Alternative

by Dec 23, 2011

You might know the more.com tool: when you pipe output to more.com, the output is displayed page by page:

PS> Get-EventLog -LogName System | more

However, "more" can be dangerous as you see here. You will not get any results for a long time, and your CPU load increases. more.com first collects all results before it starts paginating it. This takes a long time and a lot of resources.

That's why you should avoid more.com and instead use Out-Host with the parameter -Paging.

PS> Get-EventLog -LogName System | Out-Host -Paging

You immediately see the benefit: results appear momentarily, and no additional CPU load is created.

Twitter This Tip!
ReTweet this Tip!