Replaces the file extension, or adds it if there isn't one already.
Syntax
NewPath = SRP_Path("RenameExtension", Path, NewExtension)
Parameters
Parameter | Description |
---|---|
Path | A path with or without command line parameters. |
NewExtension | An extension with or without the leading period. |
Returns
The path with the new extension.
Remarks
The RenameExtension service parses the Path to locate any extension. If one is found, the extension is replaced with the NewExtension provided. It doesn't matter if NewExtension has a period as this service will ensure only one period is added.
Example
Result1 = SRP_Path("RenameExtension", "C:\path\filename.txt", ".dat") Result2 = SRP_Path("RenameExtension", "C:\path\filename.txt.dat", "exe")
Result1 will be "C:\path\filename.dat". Result2 will be "C:\path\filename.txt.exe".