Retrieves the final path of the specified file.
#Include <WinAPIEx.au3>
_WinAPI_GetFinalPathNameByHandleEx ( $hFile [, $iFlags] )
$hFile | Handle to a file or directory. |
$iFlags | [可选参数] The type of result to return. This parameter can be combination of one $FILE_NAME_* and one $VOLUME_NAME_* values. $FILE_NAME_NORMALIZED $FILE_NAME_OPENED $VOLUME_NAME_DOS $VOLUME_NAME_GUID $VOLUME_NAME_NONE $VOLUME_NAME_NT |
Success | The path of the file. |
Failure | Empty string and sets the @error flag to non-zero. |
在MSDN中搜索
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
If _WinAPI_GetVersion() < '6.0' Then
MsgBox(16, 'Error', 'Require Windows Vista or later.')
Exit
EndIf
Global $hFile
$hFile = _WinAPI_CreateFile(@ScriptFullPath, 2, 0, 6)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile) & @CR)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_GUID) & @CR)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_NT) & @CR)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_NONE) & @CR)
_WinAPI_CloseHandle($hFile)