Windows [cmd.exe]命令显示带有超时的消息框? [英] Windows [cmd.exe] command to display a messagebox with timeout?

查看:223
本文介绍了Windows [cmd.exe]命令显示带有超时的消息框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:这是 question-with-answer ,记录其他人可能会发现有用的技术,以便可能了解其他人的技术.更好的解决方案.请随时添加评论或问题作为评论.也可以随时添加其他答案. :)

如何通过键入单个Windows命令来显示消息框,例如在开始"菜单的运行" 对话框中,还是在[cmd.exe]命令解释器中?

How can I display a messagebox by typing a single Windows command, e.g. in the Run dialog from the Start menu, or in the [cmd.exe] command interpreter?

推荐答案

一种方法是使用似乎未公开的功能,即Windows .hta HTML应用程序的运行时引擎[mshta.exe]接受通用URL作为命令行参数,包括javascript:协议URL:

One way is to use apparently undocumented functionality, namely that [mshta.exe], the runtime engine for Windows .hta HTML applications, accepts a general URL as command line argument, including a javascript: protocol URL:

mshta "javascript:var sh=new ActiveXObject( 'WScript.Shell' ); sh.Popup( 'Message!', 10, 'Title!', 64 );close()"

          

            

该命令可以在例如[cmd.exe]],或例如在开始"菜单的运行对话框中,可能与 schtasks 命令结合使用以创建下午茶时间…

This command can be issued in e.g. [cmd.exe]], or e.g. in the Run dialog from the Start menu, perhaps combined with the schtasks command to create a tea-timer…

上述消息框在10秒后超时,但是将超时设置为0秒意味着不超时",从而产生了更普通的持久性消息框.

The above messagebox times out after 10 seconds, but specifying a 0 second timeout means “don’t time out”, producing a more ordinary persistent messagebox.

对于更简单的消息框,您可以使用MSHTA主机提供的alert功能.

For a simpler messagebox you can instead use the alert function provided by the MSHTA host.

这篇关于Windows [cmd.exe]命令显示带有超时的消息框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆