如何防止在脚本完成时关闭网格视图 [英] How to prevent from closing out-gridview when a script finishes
问题描述
我有一个使用 out-gridview
显示结果的脚本.这是一个简单的例子:
I have a script that presents results using out-gridview
. Here is a simple example:
"hello world" | out-gridview
当我使用 Run with PowerShell 运行脚本时,它会打开 gridview 并在打开后立即关闭它.(我认为这是因为 gridview 不是模态的,脚本完成了.)
When I run the script using Run with PowerShell, it will open gridview and close it immediately after it is opened. (I think this is because gridview is not modal and the script finishes.)
如何让 PowerShell 等到 gridview 被手动关闭?
How to make the PowerShell wait until the gridview is manually closed?
推荐答案
怎么样:
"hello world" | out-gridview -wait
根据Out-GridView
的文档,选项 -Wait
阻止 Windows PowerShell 关闭,直到 Out-GridView 窗口关闭.
According to the documentation of Out-GridView
, the option -Wait
prevents Windows PowerShell from closing until the Out-GridView window is closed.
它在 Windows PowerShell 3.0 中可用.
It is available in Windows PowerShell 3.0.
这篇关于如何防止在脚本完成时关闭网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!