This project is read-only.

New-Junction Parameter Aliases are wrong


When you want to use new-junction to link a bunch of folders, you want to do something like this:
cd C:\Where\We\Want\Junctions
ls C:\Place\Where\Targets\Are -Dir | New-Junction

# Or maybe this:
ls C:\Place\Where\Targets\Are -Dir | New-Junction C:\Where\We\Want\Junctions

# Or at worst this:
ls C:\Place\Where\Targets\Are -Dir | New-Junction { Join-Path C:\Where\We\Want\Junctions $_.Name }
The problem is that New-Junction's parameters are aliased wrong (and mandatory and don't have defaults):
Name        Aliases        Position Mandatory
----        -------        -------- ---------
LiteralPath {Path, PSPath}        0 True     
TargetPath  {Target}              1 True     
So although they're both bindable by property name, the LiteralPath is the one that's aliased to PSPath ... but I can't possibly pass something with a PSPath property to LiteralPath, because that has to be the path that doesn't exist yet....

I'm pretty sure nobody can have written a script that takes advantage of that binding ...

So I propose you:
  1. move the PSPath alias to the TargetPath parameter,
  2. make LiteralPath non-mandatory, and default it to the C# equivalent of
    Join-Path $Pwd (Split-Path $TargetPath -Leaf)


r_keith_hill wrote Oct 17, 2013 at 3:08 PM

Fixed the worst case scenario. Moved PSPath alias to TargetPath. Leaving this one open.

wrote Nov 27 at 10:00 PM