Parameter Options

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 6 months ago.

  • Author
    Posts
  • #5470

    by graybin at 2013-01-24 09:40:04

    I know that I can use Google to find possible options for some parameters, but how can I find it in powershell.
    For example. I know that I can change do
    write-host "blahblahblah" -foregroundcolor "Red"

    Using Powershell itself, how can I find out the other options besides "Red", how can I find out that "Red" is the same as 12, etc.

    by ArtB0514 at 2013-01-24 10:21:25

    [system.consolecolor].getenumValues() | foreach {"{0} :: {1}" -f $_.ToString(),$_.Value__}
    Black :: 0
    DarkBlue :: 1
    DarkGreen :: 2
    DarkCyan :: 3
    DarkRed :: 4
    DarkMagenta :: 5
    DarkYellow :: 6
    Gray :: 7
    DarkGray :: 8
    Blue :: 9
    Green :: 10
    Cyan :: 11
    Red :: 12
    Magenta :: 13
    Yellow :: 14
    White :: 15

    by graybin at 2013-01-24 10:30:38

    That didn't work for me. Is it a version issue or something else? I am running version 2 on XP

    by ArtB0514 at 2013-01-24 10:41:44

    Sorry about that, PowerShell 3 has become my default. Found a V2 PowerShell to try it out on. Do it this way:
    [enum]]) | foreach {"{0} :: {1}" -f $_.ToString(),$_.Value__}
    Black :: 0
    DarkBlue :: 1
    DarkGreen :: 2
    DarkCyan :: 3
    DarkRed :: 4
    DarkMagenta :: 5
    DarkYellow :: 6
    Gray :: 7
    DarkGray :: 8
    Blue :: 9
    Green :: 10
    Cyan :: 11
    Red :: 12
    Magenta :: 13
    Yellow :: 14
    White :: 15

    by nohandle at 2013-01-25 04:03:35

    You may also refer here for the description why this works: viewtopic.php?p=4477#p4477

You must be logged in to reply to this topic.