PowerShell

PowerShell: List Weekdays, Months, Numbers and Alphabet

You need all the days of the week or months, or even the whole alphabet in PowerShell? Here I will show you how to do that. Just take a look at the example below to learn how to find all those values mentioned in the headline of this article.

Code Sample

# Enumerate Weekdays

[Enum]::GetValues([System.DayOfWeek])

# Enumerate Months

(New-Object System.Globalization.DateTimeFormatInfo).MonthNames

# List Numbers

1..10
-10..-5

# List Alphabet

[char[]](65..90)

# Side note: List console colors

[Enum]::GetValues([System.ConsoleColor])

Nice one. Hope this is helpful.

Categories: PowerShell

Tagged as: ,

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.