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

PowerTip: Extend a string array in PowerShell

$
0
0

Summary: Use the built in features of PowerShell to easily add new Element to a string array.

Hey, Scripting Guy! Question I created an array of strings in PowerShell, but I need to add to it. Is there a simple way to do this?

Hey, Scripting Guy! Answer Absolutely. Just use += to add an element to your string array. In the following example, we add a new element to the array that’s named $HSG

$HSG+=’New String Element’

The Doctor


Viewing all articles
Browse latest Browse all 3333

Trending Articles



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