Renaming files by reformatting existing filenames – placeholders in replacement strings used with the -replace operator
Martin Brandl’s answer provides an elegant and effective solution, but it’s worth digging deeper: PowerShell’s -replace operator (… -replace <search>[, <replace>]): Takes a regular expression as its first operand, <search> (the search expression), and invariably matches globally, i.e., it replaces all matches. ‘bar’ -replace ‘[ra]’, ‘@’ -> ‘b@@’ If you want to replace a literal … Read more