Page 1 of 1

message box

Posted: 02 Jun 2011 16:47
by paul.darsey
how to make a message box in batch?

Re: message box

Posted: 02 Jun 2011 17:33
by nitt
paul.darsey wrote:how to make a message box in batch?


http://dl.dropbox.com/u/10434417/releases/commands/MSGBOX.exe

Use MSGBOX /? to get help.

Code: Select all

@echo off
for /f %%a in ('msgbox "Do you want to go to Google.COM?" "=D" 4g') do (set dog=%%a)
if "%dog%" EQU "Yes" (
start iexplore http://www.google.com/
)



When you set a message box, the result of whatever button you press is the output. Such as if I press "Abort" it will return "Abort".

Also, "4g" and "g4" are the same thing. "4" sets the message box to have the buttons "Yes" and "No". "g" sets it to a question box. The letters are not case sensitive.

Re: message box

Posted: 02 Jun 2011 17:37
by paul.darsey
that code didnt work....

Re: message box

Posted: 02 Jun 2011 17:42
by nitt
paul.darsey wrote:that code didnt work....


You have to download MSGBOX.EXE and put it in the same folder as the BAT file.

I posted the link for a reason. >.>

But, if you do not wish to use any downloads, you can always use a temporary VBScript file.

Code: Select all

@echo off

set NLM=^


set NL=^^^%NLM%%NLM%^%NLM%%NLM%

echo x=msgbox("Pick one:",vbyesnocancel,"Test")%NL%wscript.echo(x) > ~tmp.vbs
for /f %%a in ('cscript ~tmp.vbs') do (set output=%%a)
del ~tmp.vbs
echo %output%

pause



Get some VBScript MSGBOX help here.

Re: message box

Posted: 02 Jun 2011 17:59
by Cleptography
search the forms paul it's all over the place.
You will not make a msgbox in batch you will make a message box in something that talks to the console.

Re: message box

Posted: 02 Jun 2011 18:50
by Ed Dyreen
You could also use MSG /?, this gives you a simple msgbox with OK button.

You can also send messages over the network but it requires that the messenger service is running on your pc !

use this command to start the service:

Code: Select all

net start messenger

Re: message box

Posted: 02 Jun 2011 20:54
by Cleptography
Ok are we talking about a message box as the one native to winxp msgbox or the net messenger service...

Re: message box

Posted: 02 Jun 2011 21:33
by Ed Dyreen
I am talking about the net messenger service.

It's a box, can place text in it, can press OK, makes a msgbox to me. Simple but effective.

Re: message box

Posted: 02 Jun 2011 21:45
by nitt
Ed Dyreen wrote:You could also use MSG /?, this gives you a simple msgbox with OK button.

You can also send messages over the network but it requires that the messenger service is running on your pc !

use this command to start the service:

Code: Select all

net start messenger


...Neat, actually. I didn't even know there was a msg command. :P

I thought net send and such was disabled on computers >= vista.