在bash脚本/命令我怎样才能使一个PC蜂鸣声,或播放声音文件? [英] In a bash script/command how can I make a PC beep noise, or play a sound file?

查看:713
本文介绍了在bash脚本/命令我怎样才能使一个PC蜂鸣声,或播放声音文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求输入/交互减免一些长期运行脚本继续,但是当我切换到另一个窗口,我想通知(按音),一个任务就完成了,现在等待输入。

I have some long running scripts with breaks requiring input/interaction to continue but when I switch to another window I'd like to be notified (by sound) that a task is complete and now awaiting input.

我想preFER为能够播放音频剪辑(* .MP3,* .OGG等),但不会介意唯一的解决办法是使PC喇叭鸣叫声。

I would prefer to be able to play an audio clip (*.mp3, *.ogg, etc.) but wouldn't care if the only solution is to make the PC Speaker beep noise.

任何想法?我打开我可以安装任何播放CLI公用程序的声音,这反过来需要的时候我可以执行。

Any ideas? I'm open to any CLI utilities I can install that play sounds that in turn I can execute when needed.

FYI:我的系统是运行WinXP专业版

FYI: My System is running WinXP Pro.

更新:卫生署!我的Windows>控制面板>声音>默认叫声:被设置为 (无)。哎呀...

UPDATE: Doh! My Windows > Control Panel > Sounds > Default Beep: was set to (none). Grrr...

问题解决了。

推荐答案

试试这个:

回声^ g

(^ G由CTRL + G获得)。

(^G is obtained by ctrl+G).

请注意:您不能复制并粘贴到一个批处理文件这code,它不会工作。要在文件中获得^ G字,输入一个cmd窗口:

Note: you can't copy and paste this code in a batch file, it won't work. To obtain a ^G character in a file, type in a cmd window:

回声^ g> beep.txt

echo ^G > beep.txt

(同样,^ G被CTRL + G获得)。

(again, ^G is obtained by ctrl+G).

然后你就会有一个名为beep.txt文件,用记事本打开它,就会有一个方形的性格。这是我们的^ g一旦它被保存在一个文件中。

Then you'll have a file named beep.txt, open it with notepad, there will be a square character. This is our ^G once it is saved in a file.

您就可以复制并粘贴在批处理文件中发出声音(不要忘了把回声在它前面)。

You can then copy and paste it in a batch file to make a sound (don't forget to put "echo" in front of it).

这篇关于在bash脚本/命令我怎样才能使一个PC蜂鸣声,或播放声音文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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