Batch File to Make Message Box

Introduction: Batch File to Make Message Box

How To Make A Message Box With A Batch File.

Key:

0 =OK button only

1 =OK and Cancel buttons

2 =Abort, Retry, and Ignore buttons

3 =Yes, No, and Cancel buttons

4 =Yes and No buttons

5 =Retry and Cancel buttons

16 =Critical Message icon3

2 =Warning Query icon

48 = Warning Message icon

64 =Information Message icon

Step 1: The Code

@echo off

echo x=msgbox("Your Text Here" ,0, "Your Title Here") >> msgbox.vbs

start msgbox.vbs

^Sorry For MIstake!!!

Replace 0 with your number.

Step 2: Save As Msg.bat

DONE!

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    9 Discussions

    0
    Tigerboi
    Tigerboi

    2 months ago on Step 1

    Thank you for this info, but as Swaminathan.vp stated, once you have a vbs file it's best to just call it directly from the batch file. I assume then that the Yes / No button responses are specified within the batch file?

    My main question is this: How do I display the red exclamation mark warning shield icon in the dialogue box (or any red exclamation mark) as well as being able to specify whether you want Yes/No, Ok/cancel, etc as it looks from what you've written above like you have to have one or the other, which I'm surely isn't the case. Also, the number you specified for "Warning query icon" doesn't work...

    Please could you supply a few examples of working batch file script that demonstrates a few of the possibilities, and how to apply actions for clicking on Yes/No, Ok/cancel, etc?

    0
    swaminathan.vp
    swaminathan.vp

    5 months ago

    Thank you. It worked!
    1. Can this be not done without the vbs file? The vbs file stores the echo command each time when the batch file is run. This adds on the popup each time I run the batch file.
    2. How can I make an EXE run after I click on the ok button from the message box?
    I tried using &&. but did not work.

    1
    swaminathan.vp
    swaminathan.vp

    Reply 5 months ago

    I got a workaround for 1.
    I have the x=msgbox("Your Text Here" ,0, "Your Title Here") in the msgbox.vbs instead of having in the batch file.
    In the batch file, I just call or start the vbs file.
    This way I always have one popup message box.
    Thanks!
    Let me look for 2 now.

    0
    swaminathan.vp
    swaminathan.vp

    Reply 5 months ago

    For 2. I got the solution.
    For example,
    call msgbox.vbs && call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    This displays the message that I want and only when clicked on Ok, Chrome opens.
    Thanks for the help! :)

    0
    ḞrḁnḉiṡC56
    ḞrḁnḉiṡC56

    3 years ago

    This is not the answer that i've been looking for it create a vbs file lol

    0
    bryngriffiths2013
    bryngriffiths2013

    Reply 7 months ago

    why cant you do batch? cos vbs is hard

    0
    Markuz123
    Markuz123

    2 years ago

    How do you make it do something based on the button pressed

    0
    Markuz123
    Markuz123

    2 years ago

    There are two of number 2 in the options