If you need names like E01-pHi.txt, then try one of solutions:
dir | Rename-Item -NewName {$_ -replace "pHi[^.]+","pHi"}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have been trying to rename files that are listed below
E01-pHi10PAAC--62144D67--1-.txt
E02-pHi10PAAC--62144D67--1-.txt
E03-pHi10PAAC--62144D67--1-.txt
...etc
using command line
D:\PATH> dir | Rename-Item -NewName {$_ -replace "pHi*",""}
So my intention is to delete whatever after "pHi" in the file names
But the problem is that when I type the command and run it, it only delete "pHi"
I just wonder if I am doing anything wrong or if there is any case wildcard is not accepted
Thank you ahead!
If you need names like E01-pHi.txt, then try one of solutions:
dir | Rename-Item -NewName {$_ -replace "pHi[^.]+","pHi"}