function Show-OpenFileDialog
{
param
($Title=’Pick a File’, $Filter=’All|*.*|PowerShell|*.ps1′)
$type=’Microsoft.Win32.OpenFileDialog’
$dialog=New-Object -TypeName $type
$dialog.Title=$Title
$dialog.Filter=$Filter
if ($dialog.ShowDialog() -eq $true)
{
$dialog.FileName
}
else
{
Write-Warning ‘Cancelled’
}
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。