Function Reference


_WinAPI_PathRenameExtension

Replaces the extension of a file name with a new extension

#include <WinAPIShPath.au3>
_WinAPI_PathRenameExtension ( $sFilePath, $sExt )

Parameters

$sFilePath The path in which to replace the extension.
$sExt The string that contains a "." character followed by the new extension.

Return Value

Success: The path with new extension.
Failure: Empty string.

Remarks

If the file name does not contain an extension, the extension will be attached to the end of the string.

See Also

Search PathRenameExtension in MSDN Library.

Example

#include <WinAPIShPath.au3>

Local $sPath = 'C:\Documents\Test.txt'

ConsoleWrite('Before: ' & $sPath & @CRLF)
ConsoleWrite('After : ' & _WinAPI_PathRenameExtension($sPath, '.doc') & @CRLF)