函数参考


_WinAPI_EnumHardLinks

Enumerates all the hard links to the specified file.

#Include <WinAPIEx.au3>
_WinAPI_EnumHardLinks ( $sFile )

参数

$sFile The path to the file whose links are to be enumerated.

返回值

Success The array of the full paths to the links. The zeroth array element contains the number of links.
Failure 0 and sets the @error flag to non-zero, @extended flag may contain the NTSTATUS code.

注意/说明

The _WinAPI_CreateHardLink() function is only supported on the NTFS file system.

本函数需要 Windows Vista 或更高版本系统.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <Array.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global Const $sFile = @DesktopDir & '\@' & StringRegExpReplace(_WinAPI_PathFindFileName(@ScriptName), '\A_+', '')

Global $aData

; Create hard link to the current file with prefix "@" on your Desktop
_WinAPI_CreateHardLink($sFile, @ScriptFullPath)
If @error Then
    MsgBox(16, 'Error', 'Unable to create hard link.')
    Exit
EndIf

; Enumerate all hard links to the file
$aData = _WinAPI_EnumHardLinks($sFile)

_ArrayDisplay($aData, '_WinAPI_EnumHardLinks')

FileDelete($sFile)