Jump to content

Tiny command line utility msgbox.exe with timeout option


Recommended Posts

Sintaxis

for print time add "in %%d"

If you run msgbox from other program, use only one percent sign %d (like printf())

"<Message>" "<Title>" "<Flag #1-5>" "<seconds>"

for non timeout use in seconds "0"

Flags:

You may combine following box styles:

0 = OK

1 = OK + Cancel

2 = Abort + Retry + Igonore

3 = Yes + No + Cancel

4 = Yes + No

5 = Retry + Cancel

6 = Cancel + Retry + Continue

Icon:

16 Error

32 Question

48 Exclamation

64 Information

Here are the errorlevels returned:

0 Timed out

1 OK

2 Cancel

3 Abort

4 Retry

5 Ignore

6 Yes

7 No

11 Continue

You can also use %ERRORLEVEL% as environment variable, i.e.

if "%ERRORLEVEL%"=="5" goto :ignore

if "%ERRORLEVEL%"=="4" goto :retry

if "%ERRORLEVEL%"=="3" goto :abort

Link to comment
Share on other sites

  • 1 year later...

  • 7 months later...

Anyone got something like this that works on Win7 x64?

Here's a simple one line command that can be used inside a batch file. No problems with Win7 x64.

echo msgbox"my important message",64,"Some Import Title"> a.vbs & cscript a.vbs //T:5 & del a.vbs

Set your timeout by changing the //T:5 value

Coding References:

MsgBox: http://www.w3schools.com/vbscript/func_msgbox.asp

CScript: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cscript_overview.mspx?mfr=true

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...