call OpenFileDialog from powershell

Question:

When I run the following, PowerShell hangs waiting for the dialog to close, even though the dialog is never displayed:

Calling ShowDialog on a Windows.Forms.Form works fine. I also tried creating a Form and passing it as the parent to $d.ShowDialog, but the result was no different.

Answer:

I was able to duplicate your problem and found a workaround. I don’t know why this happens, but it has happened to others.

If you set the ShowHelp property to $true, you will get the dialog to come up properly.

Example:

Good Luck!

Source:

call OpenFileDialog from powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply