Last active
December 22, 2015 17:09
-
-
Save sweeneyrobb/6504243 to your computer and use it in GitHub Desktop.
a cool file select powershell script I found.
This file contains hidden or 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
function Select-FileDialog | |
{ | |
param([string]$Title, [string]$Directory, [string]$Filter="All Files (*.*)|*.*" ) | |
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null | |
$objForm = New-Object System.Windows.Forms.OpenFileDialog | |
$objForm.InitialDirectory = $Directory | |
$objForm.Filter = $Filter | |
$objForm.Title = $Title | |
$Show = $objForm.ShowDialog() | |
if ($Show -eq "OK") { | |
Return $objForm.FileName | |
} else { | |
Write-Error "Operation cancelled by user." | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment