Asserts that a file exists.
Assert-FileExists [[-Path] <String>] [[-Message] <String>] [<CommonParameters>]
Uses PowerShell's Test-Path
cmdlet to check if the file exists.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Path | String | The path to the file to check. |
false | false | |
Message | String | A description of why the assertion might fail. |
false | false |
Assert-FileExists 'C:\Windows\system32\drivers\etc\hosts'
Demonstrates how to assert that a file exists.
Assert-FileExists 'C:\foobar.txt' 'Foobar.txt wasn''t created.'
Demonstrates how to describe why an assertion might fail.