Function Reference


_WinAPI_PathGetDriveNumber

Searches a path for a drive letter within the range of 'A' to 'Z' and returns the corresponding drive number

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

Parameters

$sFilePath The path to be searched.

Return Value

Success: The string that contains the drive letter (A:, B:, etc).
Failure: Empty string.

See Also

Search PathGetDriveNumber in MSDN Library.

Example

#include <WinAPIShPath.au3>

Local $aPath[5] = ['c:\path\file', 'c:\', 'c:', 'nodrive', StringFormat('d: %270s', '2')]

For $i = 0 To UBound($aPath) - 2
        ConsoleWrite($aPath[$i] & ' => ' & _WinAPI_PathGetDriveNumber($aPath[$i]) & @CRLF)
Next

Local $iRet = _WinAPI_PathGetDriveNumber($aPath[UBound($aPath) - 1])
ConsoleWrite('TOO LONG STRING : @error = ' & @error & ' => "' & $iRet & '"' & @CRLF)