48

I've found a description of hard links and junctions in Windows, however I'd like to know ,from the Windows UI or command prompt, how I can view the hard links of a particular file or folder?

1
  • Exactly what do you mean by "view" in this context? Oct 7, 2011 at 1:51

6 Answers 6

60

The fsutil utility included in Windows XP and higher. Example:

fsutil.exe hardlink list C:\Windows\System32\notepad.exe

Sample results (from Windows 7):

\Windows\System32\notepad.exe
\Windows\notepad.exe
\Windows\winsxs\amd64_microsoft-windows-notepadwin_31bf3856ad364e35_6.1.7600.16385_none_9ebebe8614be1470\notepad.exe
\Windows\winsxs\amd64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_cb0f7f2289b0c21a\notepad.exe
2
  • 1
    Is there also any way to list soft links and junctions for a file?
    – Massimo
    Oct 7, 2011 at 5:38
  • Looks like on Server 2003 fsutil doesn't support the hardlink list subcommand. Only hardlink create is shown by fsutil hardlink.
    – bambams
    Nov 5, 2013 at 17:23
11

fsutil requires elevated system privileges. If you just need to read, and not create, links this is very inconvenient.

Microsoft releases also the free findlinks, which is much more syntax friendly, gives extra-details and does not require special privileges.

Judge yourself the same file, as from John K post, analysed with findlinks:

findlinks c:\windows\notepad.exe

FindLinks v1.0 - Locate file hard links                                                             
Copyright (C) 2011 Mark Russinovich                                                                 
Sysinternals - www.sysinternals.com                                                                 
                                                                                                    
c:\windows\notepad.exe                                                                              
        Index:  0x000037A6                                                                          
        Links:  3                                                                                   
                                                                                                    
Linking files:                                                                                      
c:\Windows\System32\notepad.exe                                                                     
c:\Windows\winsxs\amd64_microsoft-windows-notepadwin_31bf3856ad364e35_6.1.7600.16385_none_9ebebe8614
be1470\notepad.exe                                                                                  
c:\Windows\winsxs\amd64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_cb0f7f2289b0c
21a\notepad.exe                                                                                     

EDIT

While the convenience of findlinks might persist,

starting with Windows 10 Insiders build 14972, symlinks can be created without needing to elevate the console as administrator.

See blogs.windows.com/windowsdeveloper

One can also observe that now fsutil.exe does not require elevated privileges any more.

Microsoft's goal is to align the symlinks functionality to Linux standards, where they are very common.

Thanks to pinjaliina for pointing out this.

1
2

Not directly what you need but may still be useful for such goal when used cleverly:
FINDDUPE, a standalone command line utility hosted at http://www.sentex.net/~mwandel/finddupe/ address, has side functionality, which allows listing all hardlinks within a directory recursively with the following call:
finddupe -listlink <directory_of_interest>

Here is an example of what one gets as an output:

Hardlink group, 2 of 2 hardlinked instances found in search tree:
  ".\1"
  ".\_1"

Number of hardlink groups found: 1

NOTE: There is a number of projects with the similar name on SourceForge, but nothing actually hosts the utility above as for now.

1

The FindLinks tool from Sysinternals should be exactly what you need.

findlinks C:\Windows\notepad.exe
0

Try the program NTFSLinksView - works fine for me on Windows 10, should work on Vista and later.

0

The ln CLI utility by Hermann Schinagl should work:

ln --list

There's also a shell extension.

1
  • Thx for the link to this commandline tool :D
    – Radon8472
    May 8, 2019 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .