If you want to quickly exchange a file extension to create a "bak" backup version or generate a new file name for output, you should use the ChangeExtension() method:
$oldpath = 'c:\test\datei.csv' $newpath = [System.IO.Path]::ChangeExtension($oldpath, '.xls') $oldpath $newpath