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.

  • 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 May 16 '10 at 16:16
  • 3
    .lnk files are shortcut files -- a shell-level item. Symlinks are an NTFS-level link. – afrazier May 16 '10 at 17:37
  • i tried this today, cmd.exe does not seem to recognize mklink. OS was windows xp – knittl May 18 '10 at 7:44
  • @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 May 18 '10 at 13:20
  • 1
    NTFS 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 May 18 '10 at 21:30
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.