Skip to content

Commit

Permalink
demo: Open file dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
ninmonkey committed May 15, 2024
1 parent e677ca6 commit 643b44d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Pwsh/WindowsForms/Forms.OpenFileDialog.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Add-Type -AssemblyName System.Windows.Forms

[Windows.Forms.OpenFileDialog]$Dlg = @{
InitialDirectory = get-item $PSScriptRoot
Title = 'select file to upload'
Filter = 'ZIP files|*.zip|Text Documents|*.txt|Shell Scripts|*.*sh|All Files|*.*'
FilterIndex = 4

AddToRecent = $false
CheckFileExists = $true
CheckPathExists = $true
Multiselect = $false
ShowHelp = $true
ShowHiddenFiles = $false
ShowPinnedPlaces = $true
ShowPreview = $true
}

$Dlg.ShowDialog() | Out-null
'You chose file[s]: {0}' -f $Dlg.FileNames -join ', '

0 comments on commit 643b44d

Please sign in to comment.