Reputation: 147
I have a question. I have this filename.
210437.rtf
I have this PowerShell code:
Dir | rename-item -newname { $_.Name + "UV arom Fr 150-250°C, 0162-203 cond I"}
Which causes the filename to be like this: 2104437.rtfUV arom Fr 150-250°C, 0162-203 cond I
How can I change it so that it outputs this: 2104371.rtfUV arom Fr 150-250°C, 0162-203 cond I 2104371.rtf
?
Upvotes: 0
Views: 161
Reputation: 1894
Build your string however you like:
$_.Name
> 210437.rtf
$_.BaseName
> 210437
$_.Extension
> .rtf
Be aware that dir | rename ...
will rename every single item in your current workingdirectory in the way specified. I would recommend to be a bit more specific in the final script.
Upvotes: 2