< Back

Assert-FileDoesNotExist

Sun Jan 12, 2020 5:40 pm

NAME Assert-FileDoesNotExist



SYNOPSIS

Asserts that a file does not exist.





SYNTAX

Assert-FileDoesNotExist [[-Path] <String>] [[-Message] <String>] [<CommonParameters>]





DESCRIPTION

Uses PowerShell's `Test-Path` cmdlet to check if a file doesn't exist.





PARAMETERS

-Path <String>

The path to the file to check.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Message <String>

A description of why the assertion might fail.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Assert-FileDoesNotExist 'C:\\foobar.txt'



Demonstrates how to assert that a does not exist.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Assert-FileDoesNotExist 'C:\\foobar.txt' 'foobar.txt not removed.'



Demonstrates how to describe why an assertion might fail.











RELATED LINKS