主机外分页错误“未实现方法或操作。”

时间:2018-09-08 02:42:06

标签: powershell powershell-ise

我执行以下Powershell命令:

Get-Process | Out-Host -Paging

但是它返回我错误:

  

ut-lineoutput:未实现该方法或操作。   在第1行:char:1   +获取过程|主机外分页   + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       + CategoryInfo:未指定:(:) [outline-output],NotImplementedException       + FullyQualifiedErrorId:System.NotImplementedException,Microsoft.PowerShell.Commands.OutLineOutputCommand

我已经检查了有关寄出主机的帮助,并且在进行分页时,应该逐页返回结果。

基本上,我想逐页查看结果,而不是每一个都看齐。请帮助

2 个答案:

答案 0 :(得分:3)

-Paging标志不适用于powershell_ise.exe

使用powershell.exe

另一种选择,尽管它可能不一定正是您需要的...

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

答案 1 :(得分:0)

要分页,您可以这样做...

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

只需将$ page设置为您希望每页看到的内容……实际上比您想要的多1,因为您从0 NOT 1开始。因此20将显示每页21。

有人把它变成了一个模块,所以你可以做... http://community.idera.com/powershell/powertips/b/tips/posts/using-more-in-the-powershell-ise

他的脚本基本上是逐行读取每一行,然后如果您点击计数器,它会吐出“按Enter继续”,然后读取下一行,依此类推。

相关问题