PowerShell. Check if file or directory exists
If you need to know whether file is, you should use "Test-Path" cmdlet in PowerShell. It returns "True" if the file or directory exists and returns "False" in other case.
$fpath = "C:\output.xml" $isfile = Test-Path $fpath if($isfile -eq "True") { Write-host "File exists" } else { Write-host "File doesn’t exist" }
There are some more good things in this cmdlet. Write "man Test-Path" in your PowerShell console and read about it.