Replaces the extension of a file name with a new extension
#include <WinAPIShPath.au3>
_WinAPI_PathRenameExtension ( $sFilePath, $sExt )
$sFilePath | The path in which to replace the extension. |
$sExt | The string that contains a "." character followed by the new extension. |
Success: | The path with new extension. |
Failure: | Empty string. |
If the file name does not contain an extension, the extension will be attached to the end of the string.
Search PathRenameExtension in MSDN Library.
#include <WinAPIShPath.au3>
Local $sPath = 'C:\Documents\Test.txt'
ConsoleWrite('Before: ' & $sPath & @CRLF)
ConsoleWrite('After : ' & _WinAPI_PathRenameExtension($sPath, '.doc') & @CRLF)