Created
December 30, 2024 17:08
-
-
Save CN-CODEGOD/5be19815ec81c81b48035af2cfb22337 to your computer and use it in GitHub Desktop.
powershell open filedialog
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 | |
| $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ InitialDirectory = [Environment]::GetFolderPath('Desktop') } | |
| $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ | |
| #选择路径 | |
| InitialDirectory = [Environment]::GetFolderPath('Desktop') | |
| #filter 后缀 | |
| Filter = 'Documents (*.docx)|*.docx|SpreadSheet (*.xlsx)|*.xlsx' | |
| } | |
| $Null = $FileBrowser.ShowDialog() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment