Batch File to Make Message Box

118K434

Intro: 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!

10 Comments

hii, i want to ask howa i can use the message box pop-up and then i can enter a values in that message box
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?
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.
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.
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! :)

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

@echo off won't work

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

There are two of number 2 in the options