How to Open PDF File Using PowerShell

Introduction

Having ability to open PDF file from PowerShell is extremely useful. It can save you time and energy by allowing you to automate opening PDF files so we can avoid repetitive tasks.

In this article, we’ll walk through how to use PowerShell commands to open PDF file.

Solution

Using Start-Process

Once you are in PowerShell environment, you can type in Start-Process followed by the path of your PDF file.

In this case, we are going to open PDF file that is physically located at C:\Reports\Report1.pdf, you would type following script into PowerShell.


Start-Process 'C:\Reports\Report1.pdf'

The Start-Process command will launch the file immediately.

Using Invoke-Item

Another useful command is Invoke-Item which can also be used to open specific file. To use this command, simply enter it followed by the path of the file.


Invoke-Item 'C:\Reports\Report1.pdf'

This will automatically launch PDF file.

Using Call Operator (&)

Call Operator & can also be used to open the file. The pattern is the same with previous example where the operator must be followed by the path of PDF file.


& 'C:\Reports\Report1.pdf'

Conclusion

Using Windows PowerShell commands makes opening PDF file incredibly easy and efficient, just remember we can use Start-Process, Invoke-Item or Call Operator & command to open the application.