如何在Windows 10上的PowerShell中创建文件硬链接?
问题描述:
如何在Windows 10上的PowerShell中创建文件硬链接?
How do I create file hardlink in PowerShell on Windows 10?
PSCX具有New-Hardlink
,但是Windows 10上仍需要它吗?
PSCX has New-Hardlink
, but is it still needed on Windows 10?
您总是可以使用mklink
进行操作,但是从powershell要求使用cmd /c
作为该命令的前缀,这很丑陋且难以记住.
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.
答
New-Item -ItemType HardLink -Name CoverageCount.cs -Value ..\..\OPIAspnet5\Models\CoverageCount.cs
ItemType
参数现在包括一种用于硬链接的类型,我认为这是Windows 10上PowerShell的一个隐藏的宝石.
The ItemType
parameter now includes a type for hardlinks, which I feel is a hidden gem of PowerShell on Windows 10.