Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Copy Array

$
0
0

Summary: Use Windows PowerShell to copy an array.

Hey, Scripting Guy! Question How can I use Windows PowerShell to copy the contents of one array over another array?

Hey, Scripting Guy! Answer One way to do this is to use the Copy static method from the System.Array .NET Framework class, for example:

PS C:\> $a = 1,2,3,4,5

PS C:\> $b = 6,7,8,9,10

PS C:\> [array]::copy($a,$b,5)

PS C:\> $b

1

2

3

4

5


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>