Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent from closing out-gridview when a script finishes

I have a script that presents results using out-gridview. Here is a simple example:

"hello world" | out-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.)

How to make the PowerShell wait until the gridview is manually closed?

like image 855
TN. Avatar asked Jan 19 '10 23:01

TN.


2 Answers

How about:

"hello world" | out-gridview -wait

According to the documentation of Out-GridView, the option -Wait prevents Windows PowerShell from closing until the Out-GridView window is closed.

It is available in Windows PowerShell 3.0.

like image 132
Aurimas N. Avatar answered Oct 26 '22 05:10

Aurimas N.


Just add -PassThru to the Out-Gridview - adds an "OK" and "Cancel" button to the gridview - now you can "run with powershell" and close the gridview window using the OK button when you are done - soooo much more straightforward!

like image 31
user3412687 Avatar answered Oct 26 '22 03:10

user3412687