Getting Alphabetical Listings

Unfortunately, PowerShells special ".." operator only supports numeric ranges:

1..10

You can use type conversion to get a range of letters:

$OFS = ","
[string][char[]](65..90)

This will then create a comma-separated list of letters from "A" to "Z."

Twitter This Tip! ReTweet this Tip!


Posted Sep 13 2010, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.