Computer Hope

Microsoft => Microsoft DOS => Topic started by: linuxyf on July 02, 2008, 02:23:13 AM

Title: Can i Create a MessageBox with batch command??
Post by: linuxyf on July 02, 2008, 02:23:13 AM
Can i Create a MessageBox with appointed caption and displaying message using batch command??
Title: Re: Can i Create a MessageBox with batch command??
Post by: gpl on July 02, 2008, 03:02:26 AM
Yes, sort of
You can create a short vbscript file with the messagebox in it, you could write the response from the messagebox to a file and read that in your bat

Graham
Title: Re: Can i Create a MessageBox with batch command??
Post by: linuxyf on July 02, 2008, 03:31:05 AM
i know i can start a exe file displaying a messagebox implemented by c or c++.

but i want to know whether i can start a messagebox directly with batch command or not.
Title: Re: Can i Create a MessageBox with batch command??
Post by: Sidewinder on July 02, 2008, 05:28:48 AM
Quote
but i want to know whether i can start a messagebox directly with batch command or not

Batch code does not support messageboxes, popups, or windows. However this little novelty script maybe helpful:

Code: [Select]
@echo off
start %comspec% /c "mode 40,10&title My Popup&color 1e&echo.&echo. Today is %date%&echo.&echo. Press a key!&pause>NUL"

This is one of those scripts where you keep asking "What was I thinking"

 8)
Title: Re: Can i Create a MessageBox with batch command??
Post by: Carbon Dudeoxide on July 02, 2008, 05:58:25 AM
What about:

msg * Hello!!!!!!!!!!

That works in Command Prompt and in a batch file.
Title: Re: Can i Create a MessageBox with batch command??
Post by: diablo416 on July 05, 2008, 06:38:57 PM
echo msgbox"yourmesagehere">a.vbs,&;a.vbs  <<to display once
echo for i = 1 to 10>a.vbs &;echo msgbox"yourmessagehere">>a.vbs &;echo next>>a.vbs  << to display 10 times
Title: Re: Can i Create a MessageBox with batch command??
Post by: Dias de verano on July 06, 2008, 04:45:15 AM
echo msgbox"yourmesagehere">a.vbs,&;a.vbs  <<to display once

That doesn't work, gives a VBS compilation error.

This does

Code: [Select]
echo msgbox"your message here">a.vbs&a.vbs
(The semicolon and comma were causing the error)

Title: Re: Can i Create a MessageBox with batch command??
Post by: diablo416 on July 07, 2008, 10:24:04 AM
that was a typo sorry,

echo msgbox"yourmesagehere">a.vbs &;a.vbs   is what i ment instead.
Title: Re: Can i Create a MessageBox with batch command??
Post by: Dias de verano on July 07, 2008, 10:41:30 AM
that was a typo sorry,

echo msgbox"yourmesagehere">a.vbs &;a.vbs   is what i ment instead.

You don't need the semicolon (';')

This is tidier because it deletes the vbs afterwards

Code: [Select]
echo msgbox"your message here">a.vbs&a.vbs&del a.vbs