How to Open All Files That Have the Same Extension


If you have to open multiple files that have the same extension, you know how tedious it can be. Thankfully, PowerShell makes it easy to handle this task quickly and efficiently.

In this blog post, we’ll cover exactly how to open all files that have the same extension with PowerShell, so you can save time and hassle when working with multiple documents.


The general procedure to solve this problem is to collect all the files first, then pipe the result into another command to open the files.

In this context, we are trying to open all text (.txt) files in the same directory.

Using Start-Process

To collect the files we can use Get-ChildItem. The result will be piped to ForEach-Object command that will iterate the files and open each of them using Start-Process command. The Start-Process command will launch the file immediately.

Get-ChildItem -Path .\* -Include *.txt | ForEach-Object {Start-Process $_.FullName}

Using Invoke-Item

Another useful command to open the file is Invoke-Item. This time we will use this command to open the file with the same procedure as previous one.

Get-ChildItem -Path .\* -Include *.txt | ForEach-Object {Invoke-Item $_.FullName}

Using Call Operator (&)

Call Operator & can also be used to open the file. The pattern is the same with previous example.

Get-ChildItem -Path .\* -Include *.txt | ForEach-Object {& $_.FullName}


Using PowerShell commands makes opening all the files with specific extension incredibly easy and efficient, just remember after collecting all the files we can open each of them using Start-Process, Invoke-Item or Call Operator &.