Want to provide your users with a neat dialog to select folders? Simply use a COM object called Shell.Application, which provides the BrowseForFolder method:
function Select-Folder($message='Select a folder', $path = 0) {
$object = New-Object -comObject Shell.Application
$folder = $object.BrowseForFolder(0, $message, 0, $path)
if ($folder -ne $null) {
$folder.self.Path
}
}
Select-Folder
Select-Folder 'Select the folder you want!'
Select-Folder -mess 'Select some folder!' -path $env:windir