Function Reference


_WinAPI_PathFindNextComponent

Parses a path and returns the portion of that path that follows the first backslash

#include <WinAPIShPath.au3>
_WinAPI_PathFindNextComponent ( $sFilePath )

Parameters

$sFilePath The path to parse. Path components are delimited by backslashes. For instance, the path
"c:\path1\path2\file.txt" has four components: c:, path1, path2, and file.txt.

Return Value

Success: The truncated path.
Failure: Empty string and sets the @error flag to non-zero.

Remarks

This function walks a path string until it encounters a backslash ("\"), ignores everything up to that point
including the backslash, and returns the rest of the path. Therefore, if a path begins with a backslash (such as \path1\path2),
the function simply removes the initial backslash and returns the rest (path1\path2).

See Also

Search PathFindNextComponent in MSDN Library.

Example

#include <WinAPIShPath.au3>

Local $sPath = @ScriptFullPath

While $sPath
    ConsoleWrite($sPath & @CRLF)
    $sPath = _WinAPI_PathFindNextComponent($sPath)
WEnd
$sPath = _WinAPI_PathFindNextComponent("")
ConsoleWrite('Path = "' & $sPath & '" -> @error = ' & @error & @CRLF)