如何在 Windows 中查看文件的硬链接?

Joh*_*n K 40 windows hardlink

我在 Windows 中找到了硬链接和连接描述,但是我想知道,从 Windows UI 或命令提示符,我如何查看特定文件或文件夹的硬链接?

Joh*_*n K 50

Windows XP 及更高版本中包含的fsutil实用程序。例子:

fsutil.exe hardlink list C:\Windows\System32\notepad.exe
Run Code Online (Sandbox Code Playgroud)

示例结果(来自 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
Run Code Online (Sandbox Code Playgroud)


ant*_*nio 8

fsutil需要提升系统权限。如果您只需要阅读而不是创建链接,这是非常不方便的。

微软还发布了免费的findlinks,它对语法更加友好,提供了额外的细节并且不需要特殊权限。

判断自己的同一个文件,从约翰 K 帖子,分析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                                                                                     
Run Code Online (Sandbox Code Playgroud)

编辑

虽然便利性findlinks可能会持续存在,

从 Windows 10 Insiders build 14972 开始,无需将控制台提升为管理员即可创建符号链接。

请参阅blogs.windows.com/windowsdeveloper

人们还可以观察到,现在fsutil.exe不再需要提升权限。

Microsoft 的目标是将符号链接功能与 Linux 标准保持一致,因为它们在 Linux 标准中非常普遍。

感谢 pinjaliina 指出这一点。