我执行这个Powershell命令:
Get-Process | Out-Host -Paging但它会返回错误:
ut-lineoutput :方法或操作未实现。一行:1字符:1+ Get-Process +out- -Paging +~+ CategoryInfo : NotSpecified:(:)出线输出,NotImplementedException + FullyQualifiedErrorId : System.NotImplementedException,NotSpecified
我已经检查了帮助的外部主机和分页,它应该是返回结果一页一页。
基本上,我想看到的结果一页一页,而不是所有的外部同花顺。请帮帮忙
发布于 2018-09-08 05:17:02
-Paging标志不适用于powershell_ise.exe。
使用powershell.exe
另一个选择,尽管这可能不是你所需要的.
$file="c:\temp\out.txt"
dir -Recurse | Out-File $file
notepad $file发布于 2018-09-10 05:00:23
为了分页,你可以这么做.
$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
他的剧本基本上是单独读每一行,然后如果你点击你的计数器,它只会发出“按回车继续”,然后读下一行等等。
https://stackoverflow.com/questions/52231528
复制相似问题