我在我的智慧結尾。我是Powershell的新手,我已經嘗試了一切,我已經能夠在網上找到這個主題。我想要做的是將數組散列表打印到文件中,而不會在每個數組值的末尾出現愚蠢的省略號。以下是我的最佳嘗試。在Powershell中輸出數組的散列表
# Update output buffer size to prevent clipping in output window.
if($Host -and $Host.UI -and $Host.UI.RawUI)
{
$rawUI = $Host.UI.RawUI
$oldSize = $rawUI.BufferSize
$typeName = $oldSize.GetType().FullName
$newSize = New-Object $typeName (1000, $oldSize.Height)
$rawUI.BufferSize = $newSize
}
# Suposedly to allow enumeration in formatting to be unlimited
$formatenumerationlimit = -1
$Dir = get-childitem c:\SomeFolderWithFiles -recurse
$List = $Dir | where {$_.extension -eq ".hash"} | where-object {$_ -ne $null}
$lookupTable = @{}
Foreach ($element in $List)
{
#Get the type of file from filename
$PSV_Type = $element.Name.Substring(0, $element.Name.indexOf("."))
#Get the date sent from filename
$Date_Sent = $element.Name.Substring($element.Name.length - 20,8)
#Populate hashTable
.....
}
$columns = @{Expression={$_.Name};Label="Date_Sent";width=12}, @{Expression={$_.Value};Label="PSV_Types";width=1000}
$lookupTable.GetEnumerator() | Sort-Object Name | Format-Table $columns | out-file C:\hashFiles.txt -width 1012
現在這一切後,我仍然得到這個結果:
DATE_SENT PSV_Types
--------- ---------
20091201 {31,分配,AUDIT_TRAIL,書籍...}
20091202 {31,分配,AUDIT_TRAIL,書籍...}
20091203 {31,分配,AUDIT_TRAIL,書籍...}
20091204 {31,撥款,AUDIT_TRAIL,BOOKS ...}
20091207 {31,分配,AUDIT_TRAIL,書籍...}
20091208 {31,分配,AUDIT_TRAIL,書籍...}
20091209 {31,分配,AUDIT_TRAIL,書籍...}
20091210 {31 ,分配,AUDIT_TRAIL,書籍...}
20091211 {31,分配,AUDIT_TRAIL,書籍...}
20091214 {31,分配,AUDIT_TRAIL,書籍...}
20091215 {31,分配,AUDIT_TRAIL,書籍...}在powershel的方式
有人更聰明我請告訴我我錯過了什麼。我如何在最後擺脫這些血腥的省略號,並且只寫出數組中的所有成員,而不管它有多少?我是否必須通過構建一個大字符串緩衝區並將其輸出到文件中來推出一些貧民區解決方案,或者有更好的方法來完成此任務嗎?
謝謝。