Check if a file exists or not in Windows PowerShell?
Check if a file exists or not in Windows PowerShell?
Check if a file exists or not in Windows PowerShell?
Re: Check if a file exists or not in Windows PowerShell?
Just to offer [the alternative](https://msdn.microsoft.com/en-us/library/system.io.file.exists(v=vs.110).aspx) to the [`Test-Path` cmdlet](https://technet.microsoft.com/en-us/library/ee177015.aspx) (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
```
[System.IO.File]::Exists($path)
```
Does (almost) the same thing as
```
Test-Path $path -PathType Leaf
```
except no support for wildcard characters