我需要自定义OpenFileDialog并删除左侧面板。
Add-Type -AssemblyName System.Windows.Forms
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
InitialDirectory = $InitialDirectory
Multiselect = $true
Filter = 'Documents (*.docx)|*.docx|SpreadSheet (*.xlsx)|*.xlsx' # 'All Files (*.*)|*.*'
Title = $Title
}
[void]$FileBrowser.ShowDialog()
$FileBrowser.FileNames
但OpenFileDialog
无效。
这似乎可以用IFileOpenDialog
(他有_FILEOPENDIALOGOPTIONS
),但我不能在powershell中使用它