Új hozzászólás Aktív témák

  • emvy

    félisten

    válasz csabi94 #8438 üzenetére

    Tarold CSV-ben a telefonszamokat. PS-ben van olyan cmdlet, hogy Import-Csv meg Export-Csv, az esetleg jo lehet arra, hogy ird-olvasd.

    A menuvel meg igy kezdhetsz valamit:

    $title = "Phonebook"
    $message = "Menu"

    $add = New-Object System.Management.Automation.Host.ChoiceDescription "&Add", `
    "Add new phonebook entry."

    $list = New-Object System.Management.Automation.Host.ChoiceDescription "&List", `
    "List all entries."

    $search = New-Object System.Management.Automation.Host.ChoiceDescription "&Search", `
    "Search among entries."
    $delete = New-Object System.Management.Automation.Host.ChoiceDescription "&Delete", `
    "Delete from entries."
    $exit = New-Object System.Management.Automation.Host.ChoiceDescription "&Exit", `
    "Exit."

    $options = [System.Management.Automation.Host.ChoiceDescription[]]($add,$list,$search,$delete,$exit)


    do
    {
    $result = $host.ui.PromptForChoice($title, $message, $options, 4)

    switch ($result)
    {
    0 {"Add"}
    1 {"List"}
    2 {"Search"}
    3 {"Delete"}
    4 {"Exit"}
    }
    }
    while ($result -ne 4)

    Ez igy fog kinezni:

    PS C:\tmp> .\telkonyv.ps1

    Phonebook
    Menu
    [A] Add [L] List [S]Search [D] Delete [E] Exit [?] Help (default is "E"): ?
    A - Add new phonebook entry.
    L - List all entries.
    S - Search among entries.
    D - Delete from entries.
    E - Exit.
    [A] Add [L] List [S] Search [D] Delete [E] Exit [?] Help (default is "E"):
    Exit

    [ Módosította: doc ]

Új hozzászólás Aktív témák