message box

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
paul.darsey
Posts: 20
Joined: 30 May 2011 18:44

message box

#1 Post by paul.darsey » 02 Jun 2011 16:47

how to make a message box in batch?

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: message box

#2 Post by nitt » 02 Jun 2011 17:33

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.

paul.darsey
Posts: 20
Joined: 30 May 2011 18:44

Re: message box

#3 Post by paul.darsey » 02 Jun 2011 17:37

that code didnt work....

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: message box

#4 Post by nitt » 02 Jun 2011 17:42

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.

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: message box

#5 Post by Cleptography » 02 Jun 2011 17:59

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.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: message box

#6 Post by Ed Dyreen » 02 Jun 2011 18:50

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

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: message box

#7 Post by Cleptography » 02 Jun 2011 20:54

Ok are we talking about a message box as the one native to winxp msgbox or the net messenger service...

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: message box

#8 Post by Ed Dyreen » 02 Jun 2011 21:33

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.

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: message box

#9 Post by nitt » 02 Jun 2011 21:45

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.

Post Reply