Friday 18 October 2024

Check if a file exists or not in Windows PowerShell?

 

Check if a file exists or not in Windows PowerShell?

 

Just to offer the alternative to the Test-Path cmdlet (since nobody mentioned it):

[System.IO.File]::Exists($path)

Does (almost) the same thing as

Test-Path $path -PathType Leaf

except no support for wildcard characters

 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive