October 31st, 2015

PowerTip: Combine Arrays in PowerShell

Doctor Scripto
Scripter

Summary: Learn how to combine two arrays in Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to combine two arrays stored in two different variables?

Hey, Scripting Guy! Answer Use the + operator, for example:

 [array]$a = @('a','b','c')

 [array]$b = @(1,2,3)

 [array]$c = $a + $b

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.