4
How can I create hardlinks for a file on an NTFS partition using Windows?
NTFS can obviously handle hardlinks, since creating them with NTFS-3g works – the links even work in Windows. Is this the only way to create hardlinks on NTFS?
4
How can I create hardlinks for a file on an NTFS partition using Windows?
NTFS can obviously handle hardlinks, since creating them with NTFS-3g works – the links even work in Windows. Is this the only way to create hardlinks on NTFS?
4
cmd
includes the mklink
command which can create hardlinks:
Creates a symbolic link.
MKLINK [[/D] | [/H] | [/J]] Link Target
/D
Creates a directory symbolic link. Default is a file symbolic link.
/H
Creates a hard link instead of a symbolic link.
/J
Creates a Directory Junction.
Link
specifies the new symbolic link name.
Target
specifies the path (relative or absolute) that the new link refers to.
Furthermore, the excellent Far Manager has support for creating them (Alt+F6).
There are also a number of shell extensions that allow for doing so.
2
You can use Link Shell Extension to easily do what you want
1
fsutil hardlink create new_file old_file_name
You will need to run this from an elevated command prompt.
wow, even softlinks. didn't know they even existed in windows. or is it those
.lnk
files? good answer, i didn't know that command – knittl – 2010-05-16T16:16:02.9433.lnk files are shortcut files -- a shell-level item. Symlinks are an NTFS-level link. – afrazier – 2010-05-16T17:37:36.570
i tried this today, cmd.exe does not seem to recognize
mklink
. OS was windows xp – knittl – 2010-05-18T07:44:18.840@knittl: I was assuming a recent version of Windows. You know, one that still has mainstream support.
mklink
exists since Windows Vista (mostly because NTFS didn't gain symlink capabilities before that). – Joey – 2010-05-18T13:20:41.780ntfs changed from xp to vista? good to know. and well, most companies still use windows xp, not my reasoning, i prefer linux anyway :P – knittl – 2010-05-18T20:02:55.763
1NTFS features changed with every major Windows version so far. Vista brought transactions and symlinks, Windows 2000 added reparse points, quotas, sparse files and more, etc. – Joey – 2010-05-18T21:30:52.307
mklink 2 1
:You do not have sufficient privilege to perform this operation.
Really... – levant pied – 2018-01-12T18:01:12.223@levantpied: This question was about hardlinks, which you can create as a normal user. On Windows 10: »For users who have Developer Mode enabled, the mklink command will now successfully create a symlink if the user is not running as an administrator.« – Joey – 2018-01-12T21:42:58.940
@Joey To clarify - I +1ed this one, the answer itself was good + useful for me. The "Really..." part was just for my disbelief that you need admin permissions to create symlinks... – levant pied – 2018-01-16T13:46:45.443
@knittl if you want links in XP, use fsutil. – gbjbaanb – 2012-08-08T14:31:24.183