Analyse un chemin et retourne la partie de ce chemin qui suit la première barre oblique inverse
#include <WinAPIShPath.au3>
_WinAPI_PathFindNextComponent ( $sFilePath )
$sFilePath | Le chemin à analyser. Les composantes du chemin sont délimités par des barres obliques inversées. Par exemple, le chemin d'accès "c:\path1\path2\file.txt" comporte quatre composantes: c:, path1, path2, et file.txt. |
Succès: | Retourne le chemin tronqué. |
Échec: | Retourne la chaîne vide et définit @error <> 0. |
Cette fonction avance dans la chaîne de chemin jusqu'à ce qu'elle rencontre une barre oblique inverse ("\"), ignore tout jusqu'à ce point, y compris la barre oblique inverse, et retourne le reste du chemin. Par conséquent, si un chemin commence par une barre oblique inverse (comme \path1\path2), la fonction supprime simplement la barre oblique inverse et retourne le reste (path1\path2).
Consultez PathFindNextComponent dans la librairie MSDN.
#include <WinAPIShPath.au3> Local $sPath = @ScriptFullPath While $sPath <> "" ConsoleWrite($sPath & @CRLF) $sPath = _WinAPI_PathFindNextComponent($sPath) WEnd $sPath = _WinAPI_PathFindNextComponent("") ConsoleWrite('Chemin = " '& $sPath & '" -> @error = ' & @error & @CRLF)