nhmb – Message Box for bat files and scripts

nhmb is a simple lightweight program that displays a MessageBox and is used in bat files for a more convenient user experience.

nhmb is designed for using in Windows bat files and scripts.

Advantages

nhmb is free to use and distribute including commercial packages.

Designed for scripts and batch files

  • all the settings are defined through command line arguments
  • returns button code like IDOK or IDCANCEL

Extra features

  • a count down timer to run a default action when the user did not make any choice so the script will keep running instead of waiting indefinitely
  • timer value is displayed in the caption bar
  • no buttons option
  • supports multiline text

Examples

An information message box

Displaying a popup dialog box with two lines text “Backup status.The operation completed successfully”, “Backup” caption, Information icon and OK button:

nhmb "Backup status\nThe operation completed successfully" Backup Information

The program will wait indefinitely until the user clicks OK.

A message box with timer

Displaying a popup dialog box with question mark and Yes/No buttons, waiting for 3 minutes:

nhmb "Backup is about to start.\nPlease confirm?" "Backup" "Question|YesNo|DefButton2" 180

The program will return

  • IDYES If the user clicked Yes
  • IDNO if the user clicked No or nothing with 180 seconds

Processing button code

This example shows how to check what the user clicked:

nhmb "Backup is about to start.\nPlease confirm?" "Backup" "Question|YesNo|DefButton2" 180
if errorlevel 7 goto End
if errorlevel 6 goto Begin
goto End
:Begin
rem performing backup...
:End

These commands compare result code first with the code IDNO (value 7), then IDYES (value 6) and either exit bat file or run required actions.

nhmb command line

Command line parameters

This list shows all parameters of nhmb to compose command line as needed.

nhmb.exe [-esc:<ESC character>] 
<message text> <caption> <flags> [<timeout>]
<message text> - text to be displayed
<caption> - caption text for message box
<flags> - options, separated with '|' pipe character:
- Icon:
Information - icon with 'i' character
Question - question mark icon 
Warning - exclamation mark icon
Error - STOP icon
- Buttons:
Ok - only 'OK' button - default value
OkCancel - two buttons 'OK' and 'Cancel'
RetryCancel - two buttons 'Retry', 'Cancel'
YesNo - two buttons 'Yes', 'No'
YesNoCancel - three buttons 'Yes', 'No', and 'Cancel'
AbortRetryIgnore - three buttons 'Abort', 'Retry', and 'Ignore'
CancelTryContinue - three buttons 'Cancel', 'Retry', 'Continue'
NoButtons - no buttons (only when countdown timer is used)
- Default button (optional):
DefButton1 - first button (default)
DefButton2 - second button
DefButton3 - third button
Returned code:
1 (IDOK) - 'OK' button was clicked
2 (IDCANCEL) - 'Cancel' button was clicked
3 (IDABORT) - 'Abort' button was clicked
4 (IDRETRY) - 'Retry' button was clicked
5 (IDIGNORE) - 'Ignore' button was clicked
6 (IDYES) - 'Yes' button was clicked
7 (IDNO) - 'No' button was clicked
10 (IDTRYAGAIN) - 'TryAgaon' button was clicked
11 (IDCONTINUE) - 'Continue' button was clicked
<timeout> - countdown timer in seconds to automatically click default button (optional)

Command line generator

Using this form you can get full command line without having to learn program parameters – just choose needed options below:



Choose Icon
 
 
 
 

 

Choose Buttons (exact button names are language specific)






Choose a default button



Countdown timer



Command line:

nhmb.exe "Message text line #1\nMessage text line\t(TAB) #2\nMessage text line #3" "Caption" "Information|Ok" "60"

Download and install

Download nhmb

Please use the direct link below to download nhmb program and examples:

Install nhmb

nhmb has no installer and needs to be installed manually. just copy nhmb.exe to a folder on your choice.