Choose menu item

Synopsis

  choose [--menu <menu>] [--default <label>] [--timeout <timeout>]
         [--keep] <setting>

Examples

Create and display a simple menu

  menu Please choose an operating system to boot
  item fedora   Fedora Linux
  item win7     Windows 7
  choose os

Choose from a menu and go to the chosen script label

  choose target && goto ${target}

Choose from menu with a default and a three-second timeout

  menu
  item linux    Boot Linux
  item shell    Enter iPXE shell
  item exit     Exit to BIOS
  choose --default exit --timeout 3000 target && goto ${target}

Description

Choose an item from a menu and store the result in the specified setting, defaulting to the specified item after the specified timeout (in milliseconds). If no timeout is explicitly specified, or if a zero timeout is specified, then iPXE will wait indefinitely.

A sample menu

If no default item is explicitly specified, then the menu's pre-existing default item (if any) will be used. If no menu is specified, the default (unnamed) menu will be used. The menu will be automatically deleted unless the --keep option is specified.

Command status

Success A choice was stored successfully
Failure A choice was not stored successfully

See also

Notes

The user is able to use Ctrl-C (or Escape) to exit the menu without making a selection. You may therefore wish to always handle failures of the choose command. For example:

  choose os || goto cancelled

The --default option for the choose command overrides any default item specified using the item command.

You can use any valid setting name, including a scope and type. For example:

  menu Select a DNS server
  item ${netX/dns}    Current DNS server (${netX}/dns)
  item 8.8.8.8        Google public DNS
  choose dns:ipv4

You can add a background picture to enhance the appearance of your menu using the console command.

cmd/choose.txt ยท Last modified: 2014/01/23 02:37 by mcb30
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL http://ipxe.org
References to "iPXE" may not be altered or removed.