Reputation: 20247
I want to output a list can contain other lists in Powershell so that every list is displayed in a line of its own. I currently use -property SyncRoot but that gives empty lines and unnecessary words in the output. Sample code:
PS H:\> $l = @(1,2)
PS H:\> $l += ,@(3,4,5)
PS H:\> $l += ,@(23,42)
PS H:\> format-list -inputobject $l -property SyncRoot
1
2
SyncRoot : {3, 4, 5}
SyncRoot : {23, 42}
But I want the output to look like this:
1
2
{3, 4, 5}
{23, 42}
Upvotes: 0
Views: 2700
Reputation: 2888
PS> [string[]]$u = $l = @(1,2) + @(3,4,5),@(23,42)
PS> $u
1
2
3 4 5
23 42
Upvotes: 1