0

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.