【问题标题】:Out-Host -Paging error "The method or operation is not implemented. " (ISE)Out-Host -Paging 错误“方法或操作未实现。”(ISE)
【发布时间】:2018-09-08 02:42:06
【问题描述】:

我执行这个 Powershell 命令:

Get-Process | Out-Host -Paging

但它返回错误:

ut-lineoutput : 方法或操作未实现。 在行:1 字符:1 + 获取进程 |主机外分页 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [out-lineoutput], NotImplementedException + FullyQualifiedErrorId : System.NotImplementedException,Microsoft.PowerShell.Commands.OutLineOutputCommand

我已经检查了 Out-host 的帮助,并且通过分页它应该是逐页返回结果。

基本上,我希望逐页查看结果,而不是所有内容都刷新。请帮忙

【问题讨论】:

  • PowerShell ISE 不支持分页

标签: powershell powershell-ise


【解决方案1】:

-Paging 标志不适用于powershell_ise.exe

使用powershell.exe

另一种选择,虽然它可能不是您所需要的......

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

【讨论】:

  • 我需要使用 ISE,请问我应该在 ISE 中使用什么进行寻呼?
  • 我在 Google 上搜索过,ISE 不支持分页。一些其他的选择是做|输出文件或 | Out-GridView - 但并不完全相同
  • “我需要使用 ISE” - 为什么?
  • @user576510 管道到more.com: Get-Process | more
【解决方案2】:

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

$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 而不是 1 开始。所以 20 将显示每页 21。

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

他的脚本基本上单独读取每一行,然后如果你点击你的计数器,它只会吐出“按 Enter 继续”,然后读取下一行等等......

【讨论】:

    猜你喜欢
    • 2016-04-06
    • 1970-01-01
    • 2019-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-14
    • 2021-03-01
    相关资源
    最近更新 更多