Yes You can achieve that by using the below script which will open the Folder selection dialog box. But it will be different from the File selection dialog box. Please let me know if you have any questions. $out variable will have folder path in it. =============================== $FolderBrowser = new-object System.Windows.Forms.folderbrowserdialog; $out = $null; $caller = [System.Windows.Forms.NativeWindow]::new() $caller.AssignHandle([System.Diagnostics.Process]::GetCurrentProcess().MainWindowHandle) if (($FolderBrowser.ShowDialog($caller)) -eq [System.Windows.Forms.DialogResult]::OK.value__) { $out = $FolderBrowser.SelectedPath; } $out ===============================
why can folder name not show up in the file textbox
Is there anyway I can use this to select a folder rather than a file?
Yes You can achieve that by using the below script which will open the Folder selection dialog box. But it will be different from the File selection dialog box. Please let me know if you have any questions. $out variable will have folder path in it.
===============================
$FolderBrowser = new-object System.Windows.Forms.folderbrowserdialog;
$out = $null;
$caller = [System.Windows.Forms.NativeWindow]::new()
$caller.AssignHandle([System.Diagnostics.Process]::GetCurrentProcess().MainWindowHandle)
if (($FolderBrowser.ShowDialog($caller)) -eq [System.Windows.Forms.DialogResult]::OK.value__)
{
$out = $FolderBrowser.SelectedPath;
}
$out
===============================