Page 1 of 1

How to make a pop-up?

Posted: 29 Jan 2010 09:31
by beatboxx
How can I make a batch file in notpad, what shows you a pop-up?

Greetz, Bastiaan

Re: How to make a pop-up?

Posted: 29 Jan 2010 11:50
by aGerman
Hi beatboxx,

normally the batch window is also your interface to show messages. But you could use the MSG command, like

Code: Select all

@echo off
msg %username% My message.

AFAIK those doesn't work higher than Win XP.

If so, you could use an implemented VBScript, like

Code: Select all

@echo off &setlocal
set mbox="%temp%\msg.vbs"
>%mbox% echo MsgBox WScript.Arguments(0), 0, WScript.Arguments(1)

%mbox% "My message" "My title"

del %mbox%


Regards
aGerman

Re: How to make a pop-up?

Posted: 29 Jan 2010 16:41
by avery_larry
You could use the "start" command to start, for instance, notepad with a message. I'm not completely clear on what you're looking to do.


echo Put the text you want here>tmp.txt
start /wait notepad tmp.txt
del tmp.txt

Re: How to make a pop-up?

Posted: 29 Jan 2010 17:25
by BAT Beginner
this is an easy one. Code:

msg * Put Your Message Here.

Choice 2:
If you want an more up to date msgbox, then you may want to use VBS.Like Create msg.vbs, Right click and press Edit then Paste

lol = msgbox("Message Goes Here")
Save msg.vbs, then
Edit the .bat and put

@echo off
start msg.vbs


And That Should DO it

Re: How to make a pop-up?

Posted: 29 Jan 2010 17:32
by !k

Re: How to make a pop-up?

Posted: 29 Jan 2010 19:28
by aGerman
@ !k
My VBScript will probably do the same:

msgbox.vbs

Code: Select all

Option Explicit
Dim n, Text, Title, Style, i, Msg
n = WScript.Arguments.Count
If n < 2 Then WScript.Quit 8
Text = Split(WScript.Arguments(0), "\n")
Title = WScript.Arguments(1)
If n > 2 Then
  Style = WScript.Arguments(2)
Else
  Style = "okonly"
End If

Msg = Text(0)
If UBound(Text) > 0 Then
  For i = 1 To UBound(Text)
    Msg = Msg & vbCrLf & Text(i)
  Next
End If

Select Case UCase(Style)
  Case "OKONLY"
    Style = vbOKOnly
  Case "OKCANCEL"
    Style = VbOKCancel
  Case "ABORTRETRYIGNORE"
    Style = VbAbortRetryIgnore
  Case "YESNOCANCEL"
    Style = VbYesNoCancel
  Case "YESNO"
    Style = VbYesNo
  Case "RETRYCANCEL"
    Style = VbRetryCancel
  Case Else
    Style = vbOKOnly
End Select

WScript.Quit MsgBox(Msg, Style, Title)


Syntax:
msgbox.vbs "Line1[\nLine2...]" "Title" ["Style"]

Styles:
OKONLY (default)
OKCANCEL
ABORTRETRYIGNORE
YESNOCANCEL
YESNO
RETRYCANCEL

Returns:
Button / Errorlevel:
  • OK / 1
  • Cancel / 2
  • Abort / 3
  • Retry / 4
  • Ignore / 5
  • Yes / 6
  • No / 7
  • Error / 8

Regards
aGerman

Re: How to make a pop-up?

Posted: 30 Jan 2010 01:57
by !k
aGerman
Cool. I just do not understand anything in VBS