How do I create file hardlink in PowerShell on Windows 10?

yzorg picture yzorg · Aug 6, 2015 · Viewed 10.8k times · Source

How do I create file hardlink in PowerShell on Windows 10?

PSCX has New-Hardlink, but is it still needed on Windows 10?

You could always shell out to mklink, but from powershell that requires you prefix the command with cmd /c, which is ugly and hard to remember.

Answer

yzorg picture yzorg · Aug 6, 2015

New-Item -ItemType HardLink -Name CoverageCount.cs -Value ..\..\OPIAspnet5\Models\CoverageCount.cs

The ItemType parameter now includes a type for hardlinks, which I feel is a hidden gem of PowerShell on Windows 10.