I've been tasked with renaming .cab files to remove everything up to KB and the numeric part and add versioning if the numerical part of the filename is the same.
I've mocked up the following scenario and script
$a="Windows-KB-12345678-12345.cab","Windows-KB-12345678-12345.cab"
$b
=$a.Split('-').Split('.')
$i
=0
if
($b[2]-eq$b[7]) {
$c =$b[1]+$b[2]+"."+$b[4]
$d
=$b[6]+$b[7]+"-v1"+"."+$b[9]
}
Is there an easier way of doing this - using pipeline, foreach loop, substring?