Rob van der Woude's Scripting Pages

Neat Dialog Boxes in Batch Files

The demise of NET SEND and the absence of MSG.EXE in Windows * Home Editions made me write some dialog box utilities for batch files.

The command line arguments for these utilities are mostly optional, but they are "location sensitive", i.e. MessageBox' "title" argument must be the second command line argument if specified at all. So in order to specify a title, you also need to specify a message for MessageBox — which isn't an unreasonable requirement for a MessagBox.

All utilities presented on this page write the relevant selection, or entered text, to Standard Output, to allow capturing the result in a FOR /F loop.

All utilities presented on this page return an "Errorlevel" 0 if all went well and the "OK" button was clicked (or the "Enter" key pressed), 1 in case of command line errors or unexpected errors, 2 if the "Cancel" button was clicked (or the "Esc" key pressed or the "X" at the upper right corner of the window clicked, or "Alt+F4" pressed).

Note that "capturing" Errorlevels isn't really straightforward in FOR /F loops.
A sample of batch code with complete error handling:

FOR /F "tokens=*" %%A IN ('PrinterSelectBox.exe ^|^| ECHO Error^& IF ERRORLEVEL 2 ECHO Cancel') DO SET Printer=%%A
IF "%Printer%"=="Cancel" (
    ECHO ErrorLevel 2: You clicked "Cancel"
) ELSE (
    IF "%Printer%"=="Error" (
        ECHO ErrorLevel 1: An error occurred
    ) ELSE (
        ECHO ErrorLevel 0: You selected "%Printer%"
    )
)

Of course you are free to reduce error handling, and just use a default value if no valid selection was made:

SET Printer=Default Printer
FOR /F "tokens=*" %%A IN ('PrinterSelectBox.exe') DO SET Printer=%%A
SET Printer

 

The following dialog boxes are available:

 

    Download the complete Box Set

 

MessageBox

MessageBox.exe does what its name suggests: it shows a simple message in a popup window.
Like its VBScript counterpart it returns the "answer", i.e. a code for the button that was clicked. But unlike its VBScript counterpart, the answer isn't returned as an integer, but as a string, i.e. the (English, lower case) caption of the button that was clicked.
You can specify the message text, the window title, the buttons and icon, the default button, even right alignment or rigt-to-left reading, and an optional timeout.
Unlike most of my command line utilities, MessageBox displays its help text in a MessageBox as well as in Standard Error:
MessageBox.exe,  Version 1.27
Batch tool to show a message in a MessageBox and return the caption
of the button that is clicked

Usage:	MessageBox "message" "title" buttons icon default [option] timeout

Where:	buttons	"AbortRetryIgnore", "OK", "OKCancel",
		"RetryCancel", "YesNo" or "YesNoCancel"
	icon	"Asterisk", "Error", "Exclamation", "Hand",
		"Information", "None", "Question", "Stop"
		or "Warning"
	default	"Button1", "Button2" or "Button3" or the
		default button's (English) caption
	option	"HideConsole", "RightAlign", "RtlReading",
		"None" or ""
	timeout	timeout interval in seconds

Notes:	Whereas all arguments are optional, each argument requires
	all preceding arguments, i.e. icon requires "message", "title"
	and buttons, but not necessarily default, option and timeout.
	Using the "HideConsole" option will hide the console
	window permanently, thereby disabling all console based
	user interaction (e.g. "ECHO" and "PAUSE").
	It is meant to be used in scripts that run "hidden"
	themselves, e.g. VBScript with the WScript.exe interpreter.
	Do not use this option in a batch file unless hiding
	the console window permanently is intended.
	Linefeeds (\n or \012 and/or \r or \015), tabs (\t or \007),
	singlequotes (' or \047) and doublequotes (\" or \042)
	are allowed in the message string.
	Escaped Unicode characters (e.g. "\u5173" for "?")
	are allowed in the message string and in the title.
	The (English) caption of the button that was clicked
	is returned as text to Standard Output (in lower case),
	or "timeout" if the timeout interval expired.
	Code to hide console by Anthony on:
	http://stackoverflow.com/a/15079092
	MessageBox timeout based on code by DmitryG on:
	http://stackoverflow.com/a/14522952
	Note that when using the timeout feature, A window
	with the current MessageBox's TITLE will be closed,
	not necessarily the current MessageBox. To prevent
	closing the wrong MessageBox, use unique titles.
	The return code of the program is 0 if a button was clicked,
	1 in case of (command line) errors, 3 if the timeout expired.

Written by Rob van der Woude
http://www.robvanderwoude.com
MessageBox.exe is built using the .NET FrameWork's MessageBox Class.

Of all dialog boxes on this page, MessageBox.exe is the only one that be used by scheduled tasks (with credentials different from the logged in user's) to display a message on the default desktop.

InputBox

InputBox.exe was first built using the .NET FrameWork's Interaction.InputBox Method, but I found it too ugly.
A dynamically created Windows Form allowed me more freedom in design.
A large part of the C# code for InputBox.exe comes from Gorkem Gencay on StackOverflow.com.
You can specify the "prompt" text, the window title, the default value (already entered in the input text field, option not available for masked password input), an optional timeout in seconds, and the dialog box width and height, disable filtering of "risky" characters & < > | and ", add regular expression based filtering and/or an input mask (input text template), whether or not to hide (mask) the input text (for password input) and whether or not to insert a "Show password" checkbox.
When the "OK" button is clicked, the entered text is written to Standard Output.
If the dialog times out and a default text was specified, that default text is written to Standard Output.
Warning: If /N is used, either use doublequotes to "capture" the result (in a FOR /F loop), or redirect the result to a file.

InputBox,  Version 1.33
Prompt for input (GUI)

Usage:   INPUTBOX  [ "prompt"  [ "title"  [ "default" ] ] ] [ options ]

Where:   "prompt"    is the text above the input field (use \n for new line)
         "title"     is the caption in the title bar
         "default"   is the default answer shown in the input field

Options: /A          accepts ASCII characters only (requires /M)
         /B          use standard Black and white in console, no highlighting
         /H:height   sets the Height of the input box
                     (default: 110; minimum: 110; maximum: screen height)
         /L[:string] use Localized or custom captions (see Notes)
         /M:mask     accept input only if it matches mask
         /N          Not filtered, only doublequotes are removed from input
                     (default: remove & < > | ")
         /P          hides (masks) the input text (for Passwords)
         /R:regex    accept input only if it matches Regular expression regex
         /S[:text]   inserts a checkbox "Show password" (or specified text)
         /T[:sec]    sets the optional Timeout in seconds (default: 60)
         /W:width    sets the Width of the input box
                     (default: 200; minimum: 200; maximum: screen width)

Example: prompt for password
InputBox.exe "Enter your password:" "Login" /S

Example: fixed length hexadecimal input (enter as a single command line)
InputBox.exe "Enter a MAC address:" "MAC Address" "0022446688AA"
             /M:">CC\:CC\:CC\:CC\:CC\:CC" /R:"[0-9A-F]{2}(\:[0-9A-F]{2}){5}"

Notes:   For hidden input (/P and/or /S), ), "default" will be ignored.
         Be careful with /N, use doublequotes for the "captured" result,
         or redirect the result to a (temporary) file.
         Show password (/S) implies hiding the input text (/P).
         Use /M (without mask) to show detailed help on the mask language.
         Use /L for Localized "OK" and "Cancel" button captions.
         Custom captions require a string like /L:"OK=caption;Cancel=caption"
         (button=caption pairs separated by semicolons, each button optional)
         Text from input is written to Standard Output only if "OK" is clicked.
         Return code is 0 for "OK", 1 for (command line) errors, 2 for
         "Cancel", 3 on timeout, 4 if no regex or mask match.

Credits: On-the-fly form based on code by Gorkem Gencay on StackOverflow:
         http://stackoverflow.com/questions/97097#17546909
         Code to retrieve localized button captions by Martin Stoeckli:
         http://martinstoeckli.ch/csharp/csharp.html#windows_text_resources

Written by Rob van der Woude
http://www.robvanderwoude.com
If you intend to use an input mask, type InputBox.exe /M to show detailed help for the mask "language".

Masking element Description
0 Digit, required. This element will accept any single digit between 0 and 9.
9 Digit or space, optional.
# Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the Text property. Plus (+) and minus (-) signs are allowed.
L Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions.
? Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions.
& Character, required. Any non-control character. If ASCII only is set (/A), this element behaves like the "A" element.
C Character, optional. Any non-control character. If ASCII only is set (/A), this element behaves like the "a" element.
A Alphanumeric, required. If ASCII only is set (/A), the only characters it will accept are the ASCII letters a-z and A-Z and numbers. This mask element behaves like the "&" element.
a Alphanumeric, optional. If ASCII only is set (/A), the only characters it will accept are the ASCII letters a-z and A-Z and numbers. This mask element behaves like the "C" element.
. Decimal placeholder.
, Thousands placeholder.
: Time separator.
/ Date separator.
$ Currency symbol.
< Shift down. Converts all characters that follow to lowercase.
> Shift up. Converts all characters that follow to uppercase.
| Disable a previous shift up or shift down.
\ Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.
All other characters Literals. All non-mask elements will appear as themselves within MaskedTextBox. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user.

INPUTBOX.EXE "Prompt" "Title" "Default answer"

INPUTBOX.EXE "Enter your password:" "Login" /S

INPUTBOX.EXE "Enter a MAC address:" "MAC Address" "0022446688AA" /M:">CC\:CC\:CC\:CC\:CC\:CC" /R:"[0-9A-F]{2}(\:[0-9A-F]{2}){5}"

INPUTBOX.EXE "Typ uw wachtwoord" "Inloggen" /S:"Toon wachtwoord" /L:"Cancel=Annuleren"

OpenFileBox

Use OpenFileBox.exe to select an existing file.
You can specify the required file type, the start folder, and the window title.
The full path to the existing file is written to Standard Output.
OpenFileBox.exe,  Version 1.01
Batch tool to present an Open File Dialog and return the selected file path

Usage:  OPENFILEBOX  [ "filetypes"  [ "startfolder"  [ "title" ] ] ]

Where:  filetypes    file type(s) in format "description (*.ext)|*.ext"
                     or just "*.ext" (default: "All files (*.*)|*.*")
        startfolder  the initial folder the dialog will show on opening
                     (default: current directory)
        title        the caption in the dialog's title bar
                     (default: "OpenFileBox,  Version 1.01)"

Notes:  Multiple file types can be used for the filetypes filter; use "|" as a
        separator, e.g. "PDF files (*.pdf)|*.txt|Word documents (*.doc)|*.doc".
        If the filetypes filter is in "*.ext" format, "ext files (*.ext)|*.ext"
        will be used instead.
        Unless the filetypes filter specified is "All files (*.*)|*.*" or
        "*.*", the filetypes filter "|All files (*.*)|*.*" will be appended.
        The full path of the selected file is written to Standard Output
        if OK was clicked, or an empty string if Cancel was clicked.
        The return code will be 0 on success, 1 in case of (command line)
        errors, or 2 if Cancel was clicked.

Written by Rob van der Woude
http://www.robvanderwoude.com
OpenFileBox.exe was built using the .NET FrameWork's OpenFileDialog Class, which implies that it can be used to manipulate files and folders.
Always use permissions to manage user access to files and folders.

SaveFileBox

Use SaveFileBox.exe to select a target file to save to, existing or not.
Besides the required file type, start folder, and window title, you can also specify the behaviour when the selected file already exists, or when the specified file does not exist.
The full path to the selected file, existing or not, is written to Standard Output.
SaveFileBox.exe,  Version 1.00
Batch tool to present a Save File dialog and return the selected file path

Usage:  SAVEFILEBOX  "filetypes"  "startfolder"  "title"  options

Where:  filetypes    file type(s) in format "description (*.ext)|*.ext"
                     or just "*.ext" (default: "All files (*.*)|*.*")
        startfolder  the initial folder the dialog will show on opening
                     (default: current directory)
        title        the caption in the dialog's title bar
                     (default: "SaveFileBox,  Version 1.00)"
        options      /F    Force specified extension
                     /Q    Quiet mode: do not check if the file exists
                     /V    Verbose mode: prompt for confirmation
                     (default: prompt only if file exists)

Notes:  All command line arguments are optional, but each argument requires
        the ones preceeding it, e.g. "startfolder" requires "filetypes" but
        not necessarily "title" and options.
        Options /Q and /V are mutually exclusive.
        If the filetypes filter is in "*.ext" format, "ext files (*.ext)|*.ext"
        will be used instead.
        The full path of the selected file is written to Standard Output
        if OK was clicked, or an empty string if Cancel was clicked.
        The return code will be 0 on success, 1 in case of (command line)
        errors, 2 on Cancel, 3 if not in Quiet mode and file exists.

Written by Rob van der Woude
http://www.robvanderwoude.com
SaveFileBox.exe was built using the .NET FrameWork's SaveFileDialog Class, which implies that it can be used to manipulate files and folders.
Always use permissions to manage user access to files and folders.

OpenFolderBox

Use OpenFolderBox.exe to select an existing folder.
You can specify the start folder, the description above the tree view, and whether or not to hide the "Make New Folder" button.
The full path to the selected folder is written to Standard Output.
OpenFolderBox.exe,  Version 1.01
Batch tool to present a Browse Folders Dialog and return the selected path

Usage:  OPENFOLDERBOX  [ "startfolder"  [ "description" ] ]  [ /MD ]

Where:  "startfolder"  is the initial folder the dialog will show on opening
                       (default: current directory)
        "description"  is the text above the dialog's tree view
                       (default: "OpenFolderBox,  Version 1.01")
        /MD            display the "Make New Folder" button
                       (default: hide the button)

Notes:  Though the "Make New Folder" button is hidden by default, this does
        not inhibit manipulating folders using right-click or Shift+F10.
        The full path of the selected folder is written to Standard Output
        if OK was clicked, or an empty string if Cancel was clicked.
        The return code will be 0 on success, 1 in case of (command line)
        errors, or 2 if Cancel was clicked.

Written by Rob van der Woude
http://www.robvanderwoude.com
OpenFolderBox.exe was built using the .NET FrameWork's FolderBrowserDialog Class, which implies that it can be used to manipulate folders, even with the "Make New Folder" button hidden (try Shift+F10 or right-click).
Always use permissions to manage user access to (files and) folders.

PrinterSelectBox

Use PrinterSelectBox.exe to select an installed printer.
You can specify the window title, the preselected printer (either by its full name or with a regular expression), and the dialog box width.
The name of the selected printer is written to Standard Output.
The original version used Windows' own Print dialog from the .NET FrameWork's PrintDialog Class, which has a lot of features we won't need in this utility.
The current version has a more "Spartan" interface without the bells and whistles that didn't work in the old version.

See the command lines below the sample dialogs to get an idea of PrinterSelectBox's possibilities.
PrinterSelectBox,  Version 2.05
Batch tool to present a Printer Select dialog and return the selected printer

Usage:    PRINTERSELECTBOX  [ "title"  [ "selected"  [ width ] ] ]  [ options ]

Where:    "title"     is the optional caption in the title bar
          "selected"  is the optional selected printer, either its full name or
                      a regular expression (default: the default printer name)
          width       is the optional width of the input box
                      (default: 400; minimum: 400; maximum: screen width)
Options:  /L[:string] Use Localized or custom captions (see Notes)
          /P[:text]   Alternative "OK" button caption "Print" or "text"

Notes:    Use /L for Localized "OK" and "Cancel" button captions only.
          Custom captions require a "localization string" in the format
          /L:"key=value;key=value;..." e.g. for Dutch on English computers:
          /L:"Name=Naam;Where=Lokatie;Comment=Opmerking;Cancel=Annuleren"
          The name of the selected printer is written to Standard Out if the
          "OK" button is clicked, otherwise an empty string is returned.
          If "selected" is specified, the program will try an exact (literal)
          match first; if no match is found, "selected" will be interpreted as
          a regular expression, and the first match in the sorted printer list
          will be used.
          If no "title" is specified and /P is used, the alternative "OK"
          button caption ("Print" or "text") will be used for "title" too.
          Return code 0 for "OK", 1 for (command line) errors, 2 for "Cancel".

Credits:  On-the-fly form based on code by Gorkem Gencay on StackOverflow:
          http://stackoverflow.com/questions/97097
          /what-is-the-c-sharp-version-of-vb-nets-inputdialog#17546909
          Code to retrieve localized button captions by Martin Stoeckli:
          http://martinstoeckli.ch/csharp/csharp.html#windows_text_resources

Written by Rob van der Woude
http://www.robvanderwoude.com

PRINTERSELECTBOX.EXE

PRINTERSELECTBOX.EXE "Print File" /P

PRINTERSELECTBOX.EXE "Selecteer een printer" /L:"Name=Naam;Where=Lokatie;Comment=Opmerking;Cancel=Annuleren"

DateTimeBox

Use DateTimeBox.exe to select a date and/or time within the specified range and return the selected value(s) in the specified output format.
You can specify the window title, date or time only, input and output formats, and date range.
The selected date/time is written to Standard Output in the specified output format.
DateTimeBox,  Version 1.12
Batch tool to present a Date/Time Picker dialog and return the selected
date and/or time in the specified format

Usage:    DATETIMEBOX  [ "title" ]  [ "datetime" ]  [ options ]

Where:    "title"    is the optional caption in the title bar
                     (default: DateTimeBox,  Version 1.12)
          "datetime" is the optional initial date/time for the dialog
                     in "yyyy-MM-dd HH:mm" format      (default: now)
          options    /D   display and return Date only (default: date and time)
                     /T   display and return Time only (default: date and time)
                     /I24 Ignore AM/PM in Input on systems with 24-hour format
                     /O24 append AM/PM to Output on systems with 24-hour format
                     /FT:"file"          use File Timestamp of specified file
                                         for the dialog's initial date/time
                     /DD:dateformat      Date Display format (GUI)
                     /DO:dateformat      Date Output string format
                     /TD:timeformat      Time Display format (GUI)
                     /TO:timeformat      Time Output string format
                     /DTO:datetimeformat Date and Time Output string format
                     /DE:yyyy-MM-dd      Earliest Date allowed
                     /DL:yyyy-MM-dd      Latest Date allowed
                     /DMAX:numberofdays  MAXimum Date allowed, relative to
                                         today, in days (negative number for
                                         a date in the past)
                     /DMIN:numberofdays  MINimum Date allowed, relative to
                                         today, in days (negative number for
                                         a date in the past)
                     /H:height           window Height (default: 135,
                                         minimum: 135, maximum: screen height)
                     /I:index            use Icon at index from shell32.dll
                     /L[:captions]       Localize or customize button captions
                                         (e.g. /L:"OK=Why Not?;Cancel=Never!")
                     /W:width            window Width (default: 220,
                                         minimum: 220, maximum: screen width)

Example:  Display date/time in default format, output in yyyyMMddHHmmssfff
          format (year, month, day, hours, minutes, seconds, milliseconds),
          selected date between today and 90 days in the future:
          DATETIMEBOX "When?" /DTO:yyyyMMddHHmmssfff /DMIN:0 /DMAX:90

Notes:    Available custom date and time formats can be found on MSDN at:
          http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
          Note that by default AM/PM time formats ("tt" or "t") cannot be
          used on computers with a 24-hour time format. To prevent error
          messages, use /I24 to ignore "tt" or "t" (AM/PM) in specified input
          and/or output format, and /O24 to append AM/PM to the string on
          systems with 24-hour time format.
          If specified, the initial date/time must be in "yyyy-MM-dd HH:mm"
          or "yyyy-MM-dd HH:mm:ss" format; but with /D "yyyy-MM-dd" format is
          accepted, and with /T "HH:mm" and "HH:mm:ss" formats are accepted.
          If specified without captions, switch /L forces localized button
          captions (e.g. "Cancel" button caption is "Annuleren" on Dutch
          systems); if only a single custom caption is specified, the other
          one is localized (e.g. with /L:"OK=Gaan" on Dutch systems, "OK"
          button caption is "Gaan", "Cancel" button caption is "Annuleren").
          The selected date and/or time are written to Standard Out if "OK"
          is clicked, otherwise an empty string is returned.
          Switches /D, /T and /DTO are mutually exclusive.
          Return code 0 for "OK", 1 for (command line) errors, 2 for "Cancel".

Credits:  On-the-fly form based on code by Gorkem Gencay on StackOverflow:
          http://stackoverflow.com/questions/17546909
          Code to retrieve localized button captions by Martin Stoeckli:
          http://martinstoeckli.ch/csharp/csharp.html#windows_text_resources
          Code to extract icons from Shell32.dll by Thomas Levesque:
          http://stackoverflow.com/questions/6873026

Written by Rob van der Woude
http://www.robvanderwoude.com

DATETIMEBOX.EXE /DD:yyyy-MM-dd

DATETIMEBOX.EXE /D /DD:yyyy-MM-dd
(TimePicker not shown when /D is used and vv.)

DATETIMEBOX.EXE "When would be convenient?" "2016-01-01 09:30" /DD:MM/dd/yyyy /L:"Cancel=Never" /W:240
Use DropDownBox.exe to present a list of choices, and return the selected one; like CHOICE with a GUI.
You must enter a list of choices, separated by a delimiter. You can optionally add a prompt, set the window title, preselected item, and window dimensions, change the delimiter, and choose if you want the selected index to be returned as "ErrorLevel".
The selected text is written to Standard Output.
DropDownBox,  Version 1.11
Batch tool to present a DropDown dialog and return the selected item

Usage:    DROPDOWNBOX     [ "list" ]  [ "prompt"  [ "title" ] ]  [ options ]

Where:    "list"          is the list of items to populate the dropdown control
          "prompt"        is the optional text above the dropdown control
                          (default: none)
          "title"         is the window title
                          (default: "DropDownBox,  Version 1.11")
Options:  /W:width        sets the Width of the input box
                          (default: 200; minimum: 200; maximum: screen width)
          /H:height       sets the Height of the input box
                          (default: 90; minimum: 90; maximum: screen height)
          /C:index        use iCon at index from shell32.dll (default: 23)
          /D:"delimiter"  sets the Delimiter character for "list"
                          (default: semicolon)
          /F:"listfile"   use list from text File (one list item per line)
          /I:index        sets the zero based Index of the preselected item
                          (default: 0)
          /L[:"captions"] Localize or customize button captions
                          (e.g. /L:"OK=Why Not?;Cancel=No Way!")
          /T:tablength    sets the number of spaces for Tabs in prompt
                          (4..16; default: 4)
          /MF             use Monospaced Font in prompt (default: proportional)
          /NM             make dialog Non-Modal (default: modal, i.e. on top)
          /RI             Return code equals selected Index + 1, or 0 on
                          (command line) errors or if "Cancel" was clicked
                          (default: 0 on "OK", 1 on error, 2 on "Cancel")

Notes:    The selected item text is written to Standard Out if "OK" is clicked,
          otherwise an empty string is returned.
          Use either "list" or /F:"listfile", not both.
          Linefeeds (\n), tabs (\t) and doublequotes (\") are allowed in the
          prompt text (but not in the title); with tabs, /MF is recommended.
          If specified without captions, switch /L forces localized button
          captions (e.g. "Cancel" button caption is "Annuleren" on Dutch
          systems); if only a single custom caption is specified, the other
          one is localized (e.g. with /L:"OK=Gaan" on Dutch systems, "OK"
          button caption is "Gaan", "Cancel" button caption is "Annuleren").
          Return code 0 for "OK", 1 for (command line) errors, 2 for "Cancel".
          With /RI return code equals selected index + 1, or 0 for "Cancel".

Credits:  On-the-fly form based on code by Gorkem Gencay on StackOverflow:
          http://stackoverflow.com/questions/17546909
          Code to retrieve localized button captions by Martin Stoeckli:
          http://martinstoeckli.ch/csharp/csharp.html#windows_text_resources
          Code to extract icons from Shell32.dll by Thomas Levesque:
          http://stackoverflow.com/questions/6873026

Written by Rob van der Woude
http://www.robvanderwoude.com
Sample batch code, as used for the screenshot:

DROPDOWNBOX "Amsterdam;London;Paris;Tokyo" "Choose a destination" "Destination" /I:1 /RI /C:13 >NUL
SET ReturnCode=%ErrorLevel%
IF "%ReturnCode%"=="0" ECHO ErrorLevel 0: Either an error occurred or you canceled
IF "%ReturnCode%"=="1" ECHO ErrorLevel 1: You selected Amsterdam
IF "%ReturnCode%"=="2" ECHO ErrorLevel 2: You selected London
IF "%ReturnCode%"=="3" ECHO ErrorLevel 3: You selected Paris
IF "%ReturnCode%"=="4" ECHO ErrorLevel 4: You selected Tokyo


An alternative with identical results would be to create a list file named "list.txt":

Amsterdam
London
Paris
Tokyo


and change the first command line to:

DROPDOWNBOX /F:"list.txt" "Choose a destination" "Destination" /I:1 /RI /C:13 >NUL

This may be useful for long lists, or for lists created on-the-fly.

 

    Download the complete Box Set

 


page last uploaded: 2016-08-10, 13:53