I want to remove the last 11 characters of multiple files names. For example I have these file names:
ABCDE_2015_10_20
HIJKL_2015_10_20
MNOPQ_2015_10_20
RSTU
You're almost there, you just need to tell substring
exactly where to start and end:
Get-ChildItem 'E:\Thomson Reuters\Stage' | rename-item -newname { $_.name.substring(0,$_.name.length-11) }
By passing two integers to substring
you give it the StartIndex and Length of the string you want to capture. See here for the documentation