# Function Reference

# _WinAPI_PathAddExtension

Adds a file name extension to a path string

#include <WinAPIShPath.au3>
_WinAPI_PathAddExtension ( $sFilePath [, $sExt = ''] )

## Parameters

$sFilePath | The path to which the file name extension will be appended. If there is already a file name extension present, no extension will be added.
$sExt | [optional] The file name extension. If this parameter is empty string, an ".exe" extension will be added.

## Return Value

Returns the resulting path, @extended will set to 1 if an extension was added, or 0 otherwise.

## Remarks

If there is already a file name extension present, no extension will be added.
If the $sFilePath is an empty string, the result will be the file name extension only.
If $sExt is an empty string, an ".exe" extension will be added.

## See Also

Search PathAddExtension in MSDN Library.

## Example

    #include <WinAPIShPath.au3>

    Local $aPath[2] = ['C:\Documents\Test.txt', 'C:\Documents\Test']

    For $i = 0 To 1
        ConsoleWrite($aPath[$i] & ' => ' & _WinAPI_PathAddExtension($aPath[$i], '.doc') & @CRLF)
    Next