Browse for folder locks up.

Wanted to add browsing to a folder, to my script and I found this example:

Add-Type -AssemblyName System.Windows.Forms
$FolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog -Property @{
    SelectedPath = 'C:\Temp’

The first time I run it, it runs fine. But, if I run it again, it locks up my PowerShell ISE and I have to end the task from Task Manager.

In fact every example I have found runs fine the first time, but then locks up if I run it again.

Can someone help?

  • This sounds like your host has issues. This is very common code, and I use and I am sure others do this sort of thing daily. I took what you have here, and tried on three different hosts, without failure / lock no matter how many times I fire it off.

Reply Children
No Data