Out-Host -Paging error “The method or operation is not implemented. ” (ISE)

怎甘沉沦 提交于 2020-05-13 08:08:07

问题


I execute this Powershell command:

Get-Process | Out-Host -Paging

But it returns me error:

ut-lineoutput : The method or operation is not implemented. At line:1 char:1 + Get-Process | Out-Host -Paging + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [out-lineoutput], NotImplementedException + FullyQualifiedErrorId : System.NotImplementedException,Microsoft.PowerShell.Commands.OutLineOutputCommand

I have checked help for Out-host and with paging it should be returnig results page by page.

Basically I want to see results page by page not everythign flush. Please help


回答1:


The -Paging flag doesn't work for powershell_ise.exe.

Use powershell.exe

Another option though it may not be exactly what you need...

$file="c:\temp\out.txt"
dir -Recurse | Out-File $file
notepad $file



回答2:


to paginate, you could do this...

$page = 20
$step = $page
$command = get-process
$count = $command.count
while ($count -gt ($page - $step)){
    $command[($page - $step)..$page]
    Pause
    $page += $step + 1
}

Just set $page to whatever you want to see per page ... it's actually 1 more than you'd like because you start with 0 NOT 1. so 20 will show 21 per page.

some one turned this into a module, so you could do that... http://community.idera.com/powershell/powertips/b/tips/posts/using-more-in-the-powershell-ise

his script basically reads each line individually, then if you hit your counter, it just spits out "press enter to continue" then reads the next line etc...



来源:https://stackoverflow.com/questions/52231528/out-host-paging-error-the-method-or-operation-is-not-implemented-ise

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!