# display dialog and return selection.
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$openFileDialog1 = new-Object Windows.Forms.OpenFileDialog
$openFileDialog1.InitialDirectory = 'c:\'
$openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
$openFileDialog1.FilterIndex = 2
$openFileDialog1.RestoreDirectory = $true
if($openFileDialog1.ShowDialog() -eq 'OK'){
[System.Windows.Forms.MessageBox]::Show($openFIleDialog1.FileName)
}