How to make a pop-up?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
beatboxx
Posts: 1
Joined: 29 Jan 2010 09:04

How to make a pop-up?

#1 Post by beatboxx » 29 Jan 2010 09:31

How can I make a batch file in notpad, what shows you a pop-up?

Greetz, Bastiaan

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to make a pop-up?

#2 Post by aGerman » 29 Jan 2010 11:50

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

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

Re: How to make a pop-up?

#3 Post by avery_larry » 29 Jan 2010 16:41

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

BAT Beginner
Posts: 16
Joined: 29 Jan 2010 17:19

Re: How to make a pop-up?

#4 Post by BAT Beginner » 29 Jan 2010 17:25

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

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: How to make a pop-up?

#5 Post by !k » 29 Jan 2010 17:32


aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to make a pop-up?

#6 Post by aGerman » 29 Jan 2010 19:28

@ !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

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: How to make a pop-up?

#7 Post by !k » 30 Jan 2010 01:57

aGerman
Cool. I just do not understand anything in VBS

Post Reply