Bind every line from two variables in a third variable in powershell

90 Views Asked by At

I got two variables, filled with:

$Var1:
Dog
Cat
Bird

$Var2:
makes wau
makes miau
makes beep

How can I mix both of them like:

$Var3 Dog makes wau Cat makes miau Bird makes beep

$Var3 = $Var1 + $Var2 dosen't work

1

There are 1 best solutions below

0
CB. On BEST ANSWER

this is a rapid way (variables's lenght must be equal):

$i = 0 ; $var3 = $var1 | % { "$_ $($var2[$i])"; $i++ }