Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Get-FileName {
- [cmdletbinding()]
- param(
- [String]
- $StartDirectory,
- [String]
- $Title
- )
- [Void]([System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms"))
- $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
- $OpenFileDialog.InitialDirectory = $StartDirectory
- $OpenFileDialog.Filter = "All files (*.*)|*.*"
- If($Title){
- $OpenFileDialog.Title = $Title
- }
- [Void]($OpenFileDialog.ShowDialog())
- $OpenFileDialog.FileName
- }
Advertisement
Add Comment
Please, Sign In to add comment