Creating a symlink via PowerShell
In past times, I’ve used cmd’s mklink
. The PowerShell way is as follows:
New-Item -ItemType SymbolicLink -Path "C:\LINK" -Target "C:\SOURCE"
Hard link:
New-Item -ItemType HardLink -Path "C:\LINK.txt" -Target "C:\SOURCE\SRC.txt"
Junction:
New-Item -ItemType Junction -Path "C:\LINK" -Target "C:\SOURCE"
By the power of PowerShell aliases and partial parameter names, the above can all be simplified as follows:
ni -i hardlink link.txt -tar src.txt
Source On symlinks, hard links, and junctions
Bash: ln -s /path/src /path/target