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

PowerTip: A Couple Quick PowerShell Array Tricks

$
0
0

Summary:  Learn some quick tricks for using Windows PowerShell arrays.

Hey, Scripting Guy! Question How can I split the following string in the $a variable?

$a = "atl-ws-01,atl-ws-02,atl-ws-03,atl-ws-04"

Hey, Scripting Guy! Answer Use the split method :

$b = $a.split(",")

 

Hey, Scripting Guy! Question How do I join an array, such as the one in the $a variable shown here?

 $a = "h","e","l","l","o"

Hey, Scripting Guy! Answer Use the join static method from the string c


Viewing all articles
Browse latest Browse all 3333

Trending Articles



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