Created
July 29, 2022 15:53
-
-
Save F1XI/1e946621b7701d92a05216d7e43b79f7 to your computer and use it in GitHub Desktop.
Better than BrowseForFolder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add following 2 dlls to the script directory | |
# dlls from https://www.nuget.org/packages/Microsoft-WindowsAPICodePack-Shell | |
# and from https://www.nuget.org/packages/Microsoft-WindowsAPICodePack-Core | |
# for some mystical reason the script does not run in ISE but console will do | |
Add-Type -Path "$($PSScriptRoot)\Microsoft.WindowsAPICodePack.Shell.dll" | |
$dialog = New-Object Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog | |
$dialog.IsFolderPicker = $true; | |
if ($Dialog.ShowDialog() -eq [Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult]::Ok) | |
{ | |
$dialog.FileName | |
} | |
$dialog.Dispose() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment