Function Get-FileName($initialDirectory) { [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog $OpenFileDialog.initialDirectory = $initialDirectory $OpenFileDialog.filter = "All files (*.*)| *.*" $OpenFileDialog.ShowDialog() | Out-Null $OpenFileDialog.filename } Get-FileName -initialDirectory "c:\fso"