< Back
Install-CJunction
Post
NAME Install-CJunction
SYNOPSIS
Creates a junction, or updates an existing junction if its target is different.
SYNTAX
Install-CJunction [-Link] <String> [-Target] <String> [-PassThru] [-Force] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION
Creates a junction given by `-Link` which points to the path given by `-Target`. If `Link` exists, deletes it and
re-creates it if it doesn't point to `Target`.
Both `-Link` and `-Target` parameters accept relative paths for values. Any non-rooted paths are converted to
full paths using the current location, i.e. the path returned by `Get-Location`.
Beginning with Carbon 2.0, returns a `System.IO.DirectoryInfo` object for the target path, if one is created.
Returns a `System.IO.DirectoryInfo` object for the junction, if it is created and/or updated.
PARAMETERS
-Link <String>
The junction to create/update. Relative paths are converted to absolute paths using the current location.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Target <String>
The target of the junction, i.e. where the junction will point to. Relative paths are converted to absolute
paths using the curent location.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Return a `DirectoryInfo` object for the installed junction. Returns nothing if `WhatIf` switch is used. This
switch is new in Carbon 2.0.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Force [<SwitchParameter>]
Create the target directory if it does not exist.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Required? false
Position? named
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
System.IO.DirectoryInfo. To return a `DirectoryInfo` object for installed junction, use the `PassThru` switch.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Install-CJunction -Link 'C:\\Windows\\system32Link' -Target 'C:\\Windows\\system32'
Creates the `C:\\Windows\\system32Link` directory, which points to `C:\\Windows\\system32`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Install-CJunction -Link C:\\Projects\\Foobar -Target 'C:\\Foo\\bar' -Force
This example demonstrates how to create the target directory if it doesn't exist. After this example runs, the
directory `C:\\Foo\\bar` and junction `C:\\Projects\\Foobar` will be created.
RELATED LINKS
New-CJunction
Remove-CJunction
SYNOPSIS
Creates a junction, or updates an existing junction if its target is different.
SYNTAX
Install-CJunction [-Link] <String> [-Target] <String> [-PassThru] [-Force] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION
Creates a junction given by `-Link` which points to the path given by `-Target`. If `Link` exists, deletes it and
re-creates it if it doesn't point to `Target`.
Both `-Link` and `-Target` parameters accept relative paths for values. Any non-rooted paths are converted to
full paths using the current location, i.e. the path returned by `Get-Location`.
Beginning with Carbon 2.0, returns a `System.IO.DirectoryInfo` object for the target path, if one is created.
Returns a `System.IO.DirectoryInfo` object for the junction, if it is created and/or updated.
PARAMETERS
-Link <String>
The junction to create/update. Relative paths are converted to absolute paths using the current location.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Target <String>
The target of the junction, i.e. where the junction will point to. Relative paths are converted to absolute
paths using the curent location.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Return a `DirectoryInfo` object for the installed junction. Returns nothing if `WhatIf` switch is used. This
switch is new in Carbon 2.0.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Force [<SwitchParameter>]
Create the target directory if it does not exist.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Required? false
Position? named
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
System.IO.DirectoryInfo. To return a `DirectoryInfo` object for installed junction, use the `PassThru` switch.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Install-CJunction -Link 'C:\\Windows\\system32Link' -Target 'C:\\Windows\\system32'
Creates the `C:\\Windows\\system32Link` directory, which points to `C:\\Windows\\system32`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Install-CJunction -Link C:\\Projects\\Foobar -Target 'C:\\Foo\\bar' -Force
This example demonstrates how to create the target directory if it doesn't exist. After this example runs, the
directory `C:\\Foo\\bar` and junction `C:\\Projects\\Foobar` will be created.
RELATED LINKS
New-CJunction
Remove-CJunction