Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Get-FileName{
- [cmdletbinding()]
- param
- (
- $initialDirectory="$env:HOMEPATH",
- $filter="Excel Files|*.xls;*.xlsx;*.xlsm",
- $title = "Select file"
- )
- [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
- Out-Null
- $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
- $OpenFileDialog.initialDirectory = $initialDirectory
- $OpenFileDialog.Title = $title
- $OpenFileDialog.filter = $filter
- $OpenFileDialog.ShowDialog() | Out-Null
- $OpenFileDialog.filename
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement