PowerTip: View All Values of an Enum

Doctor Scripto

Dr Scripto

Summary: Boe Prox shows how to view all values of an enum.

Hey, Scripting Guy! Question How can I view all of the available values of an enum?

Hey, Scripting Guy! Answer Use the [Enum]::GetNames() method, for example:

PS C: > [Enum]::GetNames([System.ConsoleColor])

Black

DarkBlue

DarkGreen

DarkCyan

DarkRed

DarkMagenta

DarkYellow

Gray

DarkGray

Blue

Green

Cyan

Red

Magenta

Yellow

White

Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   

0 comments

    Leave a comment