Bartlomiej Wierzbicki
Bartlomiej Wierzbicki

Reputation: 13

Search files in folder Powershell

I want to search files in folder, and open it by clicking ok button on the Out-Gridview

gci | Out-GridView -PassThru | Select Name

I try using StartProcess but i need to provide name of file. I dont know how to get name of the file from out-gridview and paste it to the Start-Process -FilePath

Upvotes: 1

Views: 131

Answers (1)

Prasoon Karunan V
Prasoon Karunan V

Reputation: 3063

You could use Invoke-Item. It opens a file with its default handler.

Get-ChildItem -File | Out-GridView -PassThru |
  Select-Object -ExpandProperty FullName | Invoke-Item

Upvotes: 2

Related Questions