Skip to content

Display message boxes from Windows batch files and command line programs

License

Notifications You must be signed in to change notification settings

dbohdan/messagebox

Repository files navigation

Batch MessageBox

AppVeyor CI build status

This is a tiny hack to display message boxes from Windows batch files and command line programs. There are many like it but I didn't find any that was open source, non-copyleft and had no external dependencies like the .NET Framework.

Another goal of this project is to create a framework that makes building a simple Windows program with MinGW and running the tests for it surprisingly easy and pleasant. Never mind that; use MSYS2. (The old build scripts are preserved in the branch mingw.)

Binary downloads

You can download a prebuilt .exe file from the Releases page on GitHub.

Use example

@echo off
chcp 65001 > nul
set MB_YESNO=4
set MB_ICONQUESTION=32
set MB_ICONINFORMATION=64
set IDYES=6
set /a type=%MB_YESNO% + %MB_ICONQUESTION%
messagebox "Shall we play a game?" "Helpful Computer" %type%
if "%ERRORLEVEL%"=="%IDYES%" messagebox "What a cliché answer!" "Helpful Computer" %MB_ICONINFORMATION%

See demo.cmd for more.

Build requirements

Install MSYS2 then start the 32-bit MinGW shell (with C:\msys32\mingw32.exe or C:\msys64\mingw32.exe in an up-to-date MSYS2 installation) and run the following commands:

pacman --sync --noconfirm git make mingw-w64-i686-gcc wget
git clone http://github.com/dbohdan/messagebox
cd messagebox
make
make sendkey.exe # Download sendkey.exe and verify its checksum.
make test

License

MIT.