【发布时间】:2014-08-15 12:59:28
【问题描述】:
我一直在尝试使用 get-childitem、format-table、format-string 和 out-file 的 PowerShell 组合。
无论我使用 ft -wrap -autoformat 和其他各种选项尝试什么,get-childitem 的调用都会将 name 属性截断为总共 35 个字符(30 个,不包括扩展名),例如:
$dir = Get-ChildItem 'c:\mypath\*' | ft -Wrap -AutoSize -Property name
示例结果(注意:没有省略号,而是完整的扩展名):
myfilenametruncatesat30Charact.xlsx
全名的行为相同,截断为 106 个字符。
所以似乎 get-childitem 在将其输出到格式 cmdlet 之前受到某种类型的缓冲区的约束...
我看过一些参考资料,其中提到了 Windows 路径的 260 个字符限制,但这些路径的长度范围是 100 - 120。
任何关于 Powershell 截断原因的提示或线索将不胜感激。
【问题讨论】:
标签: powershell buffer get-childitem truncated