Is there a way to display a message box from a batch file (similar to how xmessage
can be used from bash-scripts in Linux)?
相关问题
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
- I want to trace logs using a Macro multi parameter
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- Compile and build with single command line Java (L
- CosmosDB emulator can't start since port is al
- How to print to stdout from Python script with .py
Try :
If you are using Windows XP's command.com, this will open a message box.
Opening a new cmd window isn't quite what you were asking for, I gather. You could also use VBScript, and use this with your .bat file. You would open it from the bat file with this command:
What this does is change the directory command.com will search for files from, then on the next line:
Then you create a new Notepad document, type in
You would then save this as a .vbs file (by putting ".vbs" at the end of the filename), save as "All Files" in the drop down box below the file name (so it doesn't save as .txt), then click Save!
First of all, DOS has nothing to do with it, you probably want a Windows command line solution (again: no DOS, pure Windows, just not a Window, but a Console).
You can either use the VBScript method provided by boflynn or you can mis-use
net send
ormsg
.net send
works only on older versions of windows:This also depends on the Messenger service to run, though.
For newer versions (XP and onward, apparently):
It should be noted that a message box sent using
msg.exe
will only last for 60 seconds. This can however be overridden with the/time:xx
switch.–you can write any numbers from 0,1,2,3,4 instead of 0 (before the ‘+’ symbol) & here is the meaning of each number:
–you can write any numbers from 16,32,48,64 instead of 16 (after the ‘+’ symbol) & here is the meaning of each number:
Might display a little flash, but no temp files required. Should work all the way back to somewhere in the (IIRC) IE5 era.
Don't forget to escape your parentheses if you're using
if
:it needs ONLY to popup when inside a vm, so technically, there should be some code like:
This way your batch file will create a VBS script and show a popup. After it runs, the batch file will delete that intermediate file.
The advantage of using MSGBOX is that it is really customaziable (change the title, the icon etc) while MSG.exe isn't as much.