I'm wondering if there is a way to use do a substring when using powershell's select-object cmdlet
Here is an example of what i'm trying to do
$sapFile = "C:\MyFile*.XML"
# Get the newest xml file
$newestFile = Get-ChildItem -Path $sapFile | Sort CreationTime | Select -Last 1
# get the contents of the xml file
[XML]$sapContent = Get-Content -Path $newestFile.FullName
$sapContent.DATA.CP | Select -Property CP_NO,MEN.Substring(0,4)
This however doesn't work.
Thanks