Test-PathIsJunction

Tests if a path is a junction.

Syntax

Test-PathIsJunction [[-Path] <String>] [<CommonParameters>]

Description

Tests if path is the path to a junction. If Path doesn't exist, returns false.

The alternate way of doing this is to use the IsJunction extension method on DirectoryInfo objects, which are returned by the Get-Item and Get-ChildItem cmdlets.

Parameters

Name Type Description Required? Pipeline Input Default Value
Path String

The path to check

false false

EXAMPLE 1

Test-PathIsJunction -Path C:\I\Am\A\Junction

Returns True.

EXAMPLE 2

Test-PathIsJunction -Path C:\I\Am\Not\A\Junction

Returns False.

EXAMPLE 3

Get-ChildItem * | Where-Object { $_.PsIsContainer -and $_.IsJunction }

Demonstrates an alternative way of testing for junctions. Uses Carbon's IsJunction extension method on the DirectoryInfo type to check if any directories under the current directory are junctions.