So I got this code :
$t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10, $t11 = $list[0].split(" ")
but is too much, and I think I can automate the creation of $t variables.
How is the correct procedure? with loop but to have the same result.
for ($i=0;$i -le 21; $i++) {
$objResult += New-Object -TypeName PSObject -Property @{"C$i" = ($list[0].split(" "))[$i]}
}
or with
set-variable -name "T$i" -value ($list[0].split(" "))[$i]
$t1,$t2, etc. there is nothing interesting being learned from the names (as opposed to$id,$name, etc.) and you could just as well use an array.