What does Get-Content
really output, a string or an object with several properties? If it's an object, which property contains the string, and can I modify that property? The file is only one line so I don't have to deal with an object array.
PS C:\Users\me> Get-Content input.txt 111 PS C:\Users\me> Get-Content input.txt | Select-Object * PSPath : C:\Users\me\input.txt PSParentPath : C:\Users\me PSChildName : input PSDrive : C PSProvider : Microsoft.PowerShell.Core\FileSystem ReadCount : 1 Length : 3 PS C:\Users\me> (Get-Content input.txt).GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object
-replace
erases all of the extra properties except length:
PS C:\Users\me> (Get-Content input.txt) -replace 111, 222 | Select-Object * Length ------ 3