如何在清除的屏幕上运行Powershell CMDLET并在完成后还原原件
我想知道是否有办法, stack powershell的输出主机在范围内暂时。
例如,方案是
- clear 屏幕以下功能运行
- 时,原始屏幕:
还原当功能退出演示代码
function Print-InBlank
{
[CmdletBinding()]
#Do something like Clear-Host here
Write-Host "When you see this everything else is gone"
Write-Host "Type Ctrl-C to restore"
#Do something like Restore-Host here
}
I am wondering if there is a way, to Stack Powershell's Output Host Temporarily inside a scope.
For example, scenario is to
- clear the screen when the below function runs
- restore the original screen when function exits
Demo code:
function Print-InBlank
{
[CmdletBinding()]
#Do something like Clear-Host here
Write-Host "When you see this everything else is gone"
Write-Host "Type Ctrl-C to restore"
#Do something like Restore-Host here
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论