Last active
August 23, 2018 15:19
-
-
Save gitfvb/070c1cd43feb7a60a44b15834ad7efc7 to your computer and use it in GitHub Desktop.
File Dialogue in Powershell
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
| Add-Type -AssemblyName System.Windows.Forms | |
| Function Get-FileName($initialDirectory, $filter) | |
| { | |
| $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog | |
| $OpenFileDialog.initialDirectory = $initialDirectory | |
| $OpenFileDialog.filter = $filter | |
| $OpenFileDialog.ShowDialog() | Out-Null | |
| $OpenFileDialog.filename | |
| } | |
| Get-FileName -initialDirectory $scriptPath -filter "CSV Files(*.CSV;*.TXT)|*.CSV;*.TXT|All files (*.*)|*.*"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment