Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Test-Path

Test-Path - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Determines whether all elements of a path exist.

Test-Path [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Include
 <string[]>] [-IsValid] [-PathType {Any | Container | Leaf}] [-UseTransaction] [<CommonParameters>]

Test-Path [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Include <strin
g[]>] [-IsValid] [-PathType {Any | Container | Leaf}] [-UseTransaction] [<CommonParameters>]

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