Best way to change the file extension in powershell

C++
$path = 'C:\temp\ImportantFile.txt'
Copy-Item -Path $path –Destination ([io.path]::ChangeExtension($path, '.bak')) -Verbose

Source

Also in C++: