Open files using PowerShell Get-Content

Have you ever wanted to open a file and view its contents using PowerShell? Well I am going to show you how.

I frequently output the results of PowerShell queries into files for later review but rarely used PowerShell to view the contents. This has been because I always had other programs readily available to view the contents easily so never thought to use it. The other day I was on a server where we didn’t have access to notepad and I wanted to look at a file I had generated earlier that day.

I used an old DOS command ‘type’ but saw my colleague who frequently worked on that server use a PowerShell command I was unfamiliar with. He was using Get-Content to look at some files so I used the help command to quickly familiarise myself with the command and once again I was smiling at the beauty and ease of PowerShell commands.

Get-Content C:\PowerShell\Process2.txt


Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: