I’m working my way through the “Windows PowerShell in Action” book and I was thinking I understood it but that was a stretch.
Here’s the code:
foreach-object ($f in dir *.xml) {$f = $f -replace ‘Bruces-PC’,’Inspiron15-i5′}
Now as I understand this, obviously wrong, according to page 144 of the book, this should find all the .xml files in the current directory then replace all instances of Bruces-PC with Inspiron15-i5 and then write it back to the same filename!
I’ve also tried the variant of {${$f} = ${$f} -replace …} and still no love.
I’ve also tried it with a full path on the dir command w/o luck.
Ideas? :cheers: