There are times when you need to check if a file exists – this is how you do a PowerShell check file exists.
If you try to access a file that doesn’t exist you’ll get an error:
PS> Get-Content -Path c:testz27.txt
Get-Content : Cannot find path… Read the full text.