Contact Info

Crumbtrail » Administration » Powershell » Powershell 3.0 » Test-Path

Test-Path - Powershell 3.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »


Short description
Determines whether all elements of a file or directory path exist.

Test-Path [-Path] <String[]> [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Include <String[]>
] [-IsValid] [-PathType <TestPathType>] [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Test-Path [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Include <String[]>] [-IsValid] [-Path
Type <TestPathType>] -LiteralPath <String[]> [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Test-Path [-NewerThan <DateTime>] [-OlderThan <DateTime>] [<CommonParameters>]

The Test-Path cmdlet determines whether all elements of the path exist. It returns TRUE ($true) if all elements exist a
nd FALSE ($false) if any are missing. It can also tell whether the path syntax is valid and whether the path leads to a
 container or a terminal (leaf) element.

In a file system drive, Test-Path can tell whether a path is valid, whether all elements of the path exist, or report w
hether a path leads to a file or a directory. It can also tell whether a file was changed before or after a particular 

Note: This custom cmdlet help file explains how the Test-Path cmdlet works in a file system drive. For information abou
t the Test-Path cmdlet in all drives, type "Get-Help Test-Path -Path $null" or see Test-Path at