Context is this previous linked question.
Where I seem to be stuck is on how to pipe using the ForEach-Object function as below:
PS C:\Users\Nick\Documents>
PS C:\Users\Nick\Documents> $TextInfo = (New-Object System.Globalization.CultureInfo("en-US")).TextInfo;
PS C:\Users\Nick\Documents>
PS C:\Users\Nick\Documents> $TextInfo
ANSICodePage : 1252
OEMCodePage : 437
MacCodePage : 10000
EBCDICCodePage : 37
LCID : 1033
CultureName : en-US
IsReadOnly : False
ListSeparator : ,
IsRightToLeft : False
PS C:\Users\Nick\Documents>
PS C:\Users\Nick\Documents>
PS C:\Users\Nick\Documents> $csv = Import-Csv -Path .\abcd.csv |
>> ForEach-Object {
>> $_.Name = $TextInfo.toTitleCase($_.Name)
>> $_
>> }
Exception setting "Name": "The property 'Name' cannot be found on this object. Verify that the property exists and can
be set."
At line:3 char:1
+ $_.Name = $TextInfo.toTitleCase($_.Name)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
Exception setting "Name": "The property 'Name' cannot be found on this object. Verify that the property exists and can
be set."
At line:3 char:1
+ $_.Name = $TextInfo.toTitleCase($_.Name)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
Exception setting "Name": "The property 'Name' cannot be found on this object. Verify that the property exists and can
be set."
At line:3 char:1
+ $_.Name = $TextInfo.toTitleCase($_.Name)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
Exception setting "Name": "The property 'Name' cannot be found on this object. Verify that the property exists and can
be set."
At line:3 char:1
+ $_.Name = $TextInfo.toTitleCase($_.Name)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
Exception setting "Name": "The property 'Name' cannot be found on this object. Verify that the property exists and can
be set."
At line:3 char:1
+ $_.Name = $TextInfo.toTitleCase($_.Name)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
PS C:\Users\Nick\Documents>
PS C:\Users\Nick\Documents> $csv
alpha beta charlie delta
----- ---- ------- -----
sdkljgsdf bdgfhgfnhm ngfgfddfsg dfhgsdfg
gfjd;saklbf dfbdfgfn vfsdafdfbn fgjtyj
bdgfkl; dsfsd vgngfas dsfhgtj
dsbmnkl nggfn bfdsda edtshdgf
asdfkl sdagfdfh vbdfdngt ngfggj
PS C:\Users\Nick\Documents>
mostly using Linux, which I think is PS Core. Above, this is on Windows.
I tried the above code on Windows. Looking to use the REPL console.
This is a follow up to a question which I cannot edit at the moment.
Mostly, just an iteration problem with the console usage. By REPL I mean the console on the command line -- either bash or the windows CMD.