MessageBox

A message with buttons from the command line

MessageBox.exe
Version
1.9.0.0
System
Windows, 32-bit (runs on 64-bit too)
Source
github.com/pedromagician/CMD_MessageBox

No installation: unzip anywhere (ideally into a folder on your PATH) and run it from the command line or a batch file.

MessageBox

MessageBox shows the classic Windows message box from the command line. Useful in scripts and installers when you need to tell the user something or ask yes/no. It prints the pressed button to the output and can also return it as an exit code.

Features

Usage

MessageBox.exe -t "Hello" -m "This is a message."
MessageBox.exe -t "Info" -m "Line 1\nLine 2\nLine 3"

Store the answer in a variable:

@set "output="
@for /f "usebackq delims=" %%A in (`messagebox -message "yes or no" -button yesno`) do @set "output=%%A"
@echo output: %output%

Options

SwitchDescription
-title, -tWindow title.
-message, -mMessage text, supports \n and \u{XXXX}.
-icon, -iIcon: noicon, information, question, warning, error.
-button, -bButtons: ok (1), okcancel, yesno (2), yesnocancel (3).
-b1, -b2, -b3Custom button labels.
-default, -dDefault button (1–3).
-monitor, -monMonitor: Primary, Mouse, MousePointer or an index (0, 1, 2 …).
-position, -posPlacement: center, top, bottom, left, right, pointer, xy.
-x, -yOffset in pixels.
-windowsReturnCode, -wrcWindows MessageBox return codes.
-quietNo console output.
-help, -h, -?Help.