10

This is my array :

$array who contains theses values :

Y:\155150716070\00000027.JPG
Y:\155150716070\00000028.JPG
Y:\155150716070\00000029.JPG
Y:\155150716070\00000030.JPG
Y:\155150716070\00000031.JPG
Y:\155150716070\00000032.JPG
Y:\155150716070\00000033.JPG
Y:\155150716070\00000034.JPG
Y:\155150716070\00000035.JPG
Y:\155150716070\00000036.JPG

How can i replace "JPG" by "TIF" to get something like that ?

Y:\155150716070\00000027.TIF
Y:\155150716070\00000028.TIF
Y:\155150716070\00000029.TIF
Y:\155150716070\00000030.TIF
Y:\155150716070\00000031.TIF
Y:\155150716070\00000032.TIF
Y:\155150716070\00000033.TIF
Y:\155150716070\00000034.TIF
Y:\155150716070\00000035.TIF
Y:\155150716070\00000036.TIF

Thanks for your help

1 Answer 1

22

Using -replace as an array operator:

$array -replace 'JPG$','TIF'
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.