如何使用批处理文件从内置的PC扬声器启动系统“哔哔声"? [英] How to start a system "beep", from the built-in pc speaker, using a batch file?

查看:76
本文介绍了如何使用批处理文件从内置的PC扬声器启动系统“哔哔声"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经以交互方式编写了一个批处理脚本,用于执行一些任务.

I have written a batch script in an interactive mode, for making some tasks.

有时,这些任务需要很长时间才能完成,然后该批处理询问用户是要继续执行下一个任务,还是返回到批处理的主菜单或...等等

Sometimes, These tasks takes a long time to be finished, and then the batch asks if the user wants to go on to the next task, or back to the Batch's Main Menu or... etc

现在,我要做的是添加一个交互式警报"命令,该命令听起来会发出一声短促的哔哔声(例如:就像打开PC时一样),以向批处理用户发出新问题的警报.

Now, what I want to do, is to add an "Interactive Alarm" command, that sounds a small short beep (Ex: Like the one when we turn on our PCs), to alert the batch user for new questions .

我不知道这是否可行,但是对我来说最重要的是,不要使用WMP之类的GUI应用程序. 我只想从后台执行此操作,即使必须从免费扬声器发出提示音,也可以使用第三方CLI应用程序(顺便说一句,我在Win7-x64上安装了Cygwin).

I don't know if this is possible or not, but the most important thing for me, NOT to use a GUI application like WMP or so.. I just want to do this from the Background, even If that beep has to be made from the free speaker, or by using a Third-Party CLI Application (Btw, I've Cygwin installed on my Win7-x64) .

请注意,我将在交互问题之前恰好添加该警报命令,等待用户的回答进入下一阶段,所以我不能只是通过发出真正的错误蜂鸣声来完成批处理!

Please note that, I will add that alarm command exactly before the interactive questions, waiting for user's answer to get to the next stage, so I can't just finish the batch, by making a real error beep !

那么,有人可以告诉我该怎么做吗?

So, would somebody please tell me how to do this ?

感谢您的帮助:)

推荐答案

不可能直接在(例如)记事本中键入BEL.

It's not possible to type the BEL directly in (for example) notepad.

要获取它,请在命令行上键入echo ^G>>yourbatch.bat(不要键入^ G,而要键入<Control>-G,它将在屏幕上显示为^G).这会在文件末尾添加一个看起来很奇怪的字符.这就是BEL字符0x007("control-G").只需将其复制/移动到任何echo命令即可.也是

To get it, type echo ^G>>yourbatch.bat on the command line (don't type ^ G, but <Control>-G, which will be shown as ^G on the screen). That puts a strange looking character to the end of your file. That's the BELcharacter 0x007 ("control-G"). Just copy/move it to any echo command, you like. Also

set /p "input=^Ggive value: "

是可能的(其中^G代表那个奇怪的字符)

is possible (where the ^G represents that strange char)

这篇关于如何使用批处理文件从内置的PC扬声器启动系统“哔哔声"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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