powershell – Print Array Elements on one line

powershell – Print Array Elements on one line

Use the -join operator:

$array -join ;

You can also call the String.Join method:

[String]::Join(, $array);

In either case the result will be a new String instance with each element in $array concatenated together.

Just use

-join $array

which will glue all elements together.

powershell – Print Array Elements on one line

#I am unable to enter data into an array and then output as a file… I keep getting multiple lines:
$Output+= $Name,,($IPV4.IPV4Address).IPAddressToString # Fills the array with the #true response

Leave a Reply

Your email address will not be published.