I've been experimenting with a PowerShell combination of get-childitem, format-table, format-string, and out-file.
No matter what I try with ft -wrap -autoformat and various other options, the call of get-childitem truncates the name property to 35 characters total (30, excluding extension), e.g.:
$dir = Get-ChildItem 'c:\mypath\*' | ft -Wrap -AutoSize -Property name
Sample result (note: no ellipsis, but full extension):
myfilenametruncatesat30Charact.xlsx
Same behavior for fullname which truncates at 106 characters.
So it seems get-childitem is constrained by some type of buffer prior to piping it out to a format cmdlet...
I've seen references which speak of a 260 character limit for windows pathing, but these paths are in the 100 - 120 length range.
Any tips or clues as to why Powershell is truncating would be greatly appreciated.
You can use
Get-ChildItem 'c:\mypath\*' | Select -ExpandProperty Name
-ExpandProperty
Specifies a property to select, and indicates that an attempt should be made to expand that property. Wildcards are permitted in the property name.
For example, if the specified property is an array, each value of the array is included in the output. If the property contains an object, the properties of that object are displayed in the output.
Edit
PS C:\Users\Lieven\AppData\Local\Temp> gci myfilenametruncatesat30CharactAndThenSome.xlsx | ft -Wrap -AutoSize -Property
name
Name
----
myfilenametruncatesat30CharactAndThenSome.xlsx