Replaces the file extension, or adds it if there isn't one already.
NewPath = SRP_Path("RenameExtension", Path, NewExtension) |
Parameter | Description |
---|---|
Path | A path with or without command line parameters. |
NewExtension | An extension with or without the leading period. |
The path with the new extension.
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.
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".
AddExtension, GetExtension, RemoveExtension