This is a pretty specific request. If anything changes the script gets more complex. But string manipulation is pretty simple, and there's a lot of ways to do the same thing. Here's one example:
$str = Get-Item -Path 'C:\Path\To\WW-459-1-6401HR5.txt' | Select-Object -Property Name -ExpandProperty Name
$newStr = $str.Substring(0,$str.IndexOf("640")-1)
$newstr
$ext = $str.Substring($str.IndexOf("."),$str.Length - $str.IndexOf("."))
$ext
$finalStr = $newStr + $ext
$finalStr
Obviously you'll still need to add some logic to grab all the files and loop through them, but this takes care of the string manipulation that you requested.