New-Junction
Create a junction
param([string]$junction = "", [string]$targetDir = "")
try {
if ($junction -eq "" ) { $junction = Read-Host "Enter the new junction's path and filename" }
if ($targetDir -eq "" ) { $targetDir = Read-Host "Enter the path to the target directory " }
New-Item -path "$junction" -itemType Junction -value "$targetDir"
"? New junction '$junction' created, linking to: ??$targetDir"
exit 0 # success
} catch {
"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}Specifies the path and filename of the new junction
Specifies the path to the target directory