Created
May 27, 2021 12:51
-
-
Save FriedrichWeinmann/6e96d40c080d059ed570e4f660b725f9 to your computer and use it in GitHub Desktop.
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
function Show-SaveFileDialog { | |
[CmdletBinding()] | |
param ( | |
[string] | |
$InitialDirectory = '.', | |
[string] | |
$Filter = '*.*', | |
$Filename | |
) | |
$saveFileDialog = [Windows.Forms.SaveFileDialog]::new() | |
$saveFileDialog.FileName = $Filename | |
$saveFileDialog.InitialDirectory = Resolve-Path -Path $InitialDirectory | |
$saveFileDialog.Title = "Save File to Disk" | |
$saveFileDialog.Filter = $Filter | |
$saveFileDialog.ShowHelp = $True | |
$result = $saveFileDialog.ShowDialog() | |
if ($result -eq "OK") { | |
$saveFileDialog.FileName | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment