Removes the trailing file name and backslash from a path, if they are present.
#Include <WinAPIEx.au3>
_WinAPI_PathRemoveFileSpec ( $sPath )
$sPath | The path from which to remove the file name. |
Success | The path without file name. |
Failure | Empty string and sets the @error flag to non-zero. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Path = 'C:\Documents\Test.txt'
ConsoleWrite('Before: ' & $Path & @CR)
ConsoleWrite('After : ' & _WinAPI_PathRemoveFileSpec($Path) & @CR)