Tests if a path is a junction.
Test-PathIsJunction [[-Path] <String>] [<CommonParameters>]
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.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Path | String | The path to check |
false | false |
Test-PathIsJunction -Path C:\I\Am\A\Junction
Returns True
.
Test-PathIsJunction -Path C:\I\Am\Not\A\Junction
Returns False
.
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.