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. |
在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)