# path::change-extension

Changes the extension of the path string.

### Usage

`string path::change-extension(path, extension)`

### Parameters

Name | Type | Description
--- | --- | ---
path | string | The path information to modify. The path cannot contain any of the characters defined in InvalidPathCharsInvalidPathChars.
extension | string | The new extension (with a leading period). Specify a null reference to remove an existing extension from path.

### Return Value

A string containing the modified path information.

On Windows-based desktop platforms, if path is an empty String, the path information is returned unmodified. If path has no extension, the returned path String contains extension appended to the end of path.

### Exceptions

The function will fail in any of the following circumstances:

- path contains one or more invalid characters.

### Remarks

For more information see the Path documentation.

### Requirements

Assembly: NAnt.Core (0.92.4543.0)