powershell printing custom object write-host

时间:2017-10-23 00:30:24

标签: powershell

I've created a custom object and tried to print out the object:

$longest_common_entry= New-Object System.Object
$longest_common_entry | Add-Member -type NoteProperty -name s1 -Value $mytext[0]
$longest_common_entry | Add-Member -type NoteProperty -name s2 -Value $mytext[1]
$longest_common_entry | Add-Member -type NoteProperty -name lcs -Value ""
$longest_common_entry | Add-Member -type NoteProperty -name lcs_length -Value 0

Write-Host $longest_common_entry
System.Object

Write-Output $longest_common_entry<BR>
s1 s2 lcs lcs_length
-- -- --- ----------
"Report Technical Design 0.4.docx" "Report Technical Design 0.3.docx" "" 0

Why does write-output displays the object content but not write-host?

0 个答案:

没有答案