I need to show a list of file names without paths and open the selected file.
I can get it to work with full paths:
Get-ChildItem *.txt -Recurse | Sort-Object Name| Out-GridView -PassThru | Invoke-Item
But when I try to show only the file names it fails:
Get-ChildItem *.txt -Recurse | Sort-Object Name| Select-Object Name | Out-GridView -PassThru | Invoke-Item
By piping it through Get-Member I understand that Select-Object Name striped all non-Name properties. So how can I trace the original file object from what I got from GridView?