Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Beeping in DOS

2,111 views
Skip to first unread message

Peter Geddes

unread,
May 27, 2001, 7:27:23 AM5/27/01
to
I wondered if anyone could tell me how to make a batch file beep. I've
tried CTRL P CTRL G, but this doesn't work.

This will be entered in either DOS Edit or Notepad

TIA

PS - This is resent because my system clock was set to the wrong date!!

Peter Geddes

Outsider

unread,
May 27, 2001, 7:36:24 AM5/27/01
to

The beep character is the seventh ASCII character and is one of the
'control' characters. In the DOS editor, the beep character can be
obtained by pressing [Ctrl+[P][G]].

:: beep.bat (beeps once)
@ECHO off
ECHO [Ctrl+[P][G]]
::

This is the same batch created at prompt using redirection. Notice that the
[P] is not required here, and the beep character will appear in beep.bat.

C:\BAT>ECHO @ECHO OFF > beep.bat
C:\BAT>ECHO ECHO [Ctrl+[G]] >> beep.bat


--
Outsider, HB, BFP
MS-DOS 6.22, Windows for Workgroups 3.11, Netscape Navigator 4.08
"Men never do evil so completely and cheerfully as when they do it
from religious conviction." -- Blaise Pascal

William Allen

unread,
May 27, 2001, 7:52:56 AM5/27/01
to
Peter Geddes wrote in message

> I wondered if anyone could tell me how to make a batch file beep. I've
> tried CTRL P CTRL G, but this doesn't work.
>
> This will be entered in either DOS Edit or Notepad

You can enter it directly in the file, usually [Alt+[7]] with
[7] on the number keypad. Syntax varies slightly with particular
editor. May require [Alt+ [0] [0] [0] [7]] with NumLock ON, or Ctrl-P prefix.

Or, it's quite simple to generate it with debug, thus:

::====BEEP.BAT
@ECHO OFF
:: Make an beep character in environment variable BEEP
ECHO e100'SET %%1='7 0d 0a>%TEMP%.\BEEP.BAT
FOR %%F IN (rcx a w q) DO ECHO %%F>>%TEMP%.\BEEP.BAT
TYPE %TEMP%.\BEEP.BAT | debug %TEMP%.\BEEP.BAT>NUL
CALL %TEMP%.\BEEP.BAT BEEP
DEL %TEMP%.\BEEP.BAT

:: Instantiate %BEEP% in a ECHO to beep
ECHO. This is a beep %BEEP%
SET BEEP=
::====

This is just a cut-and-paste search-and-replace operation on
the COLOUR.BAT I've just posted, by the way<G>.

--
William Allen


Message has been deleted

Peter Geddes

unread,
May 27, 2001, 5:59:41 PM5/27/01
to
Thanks for the tips. The batch files sent give a Windows Beep (chimes.wav)
, not a BIOS like beep.

TIA's

Peter Geddes


William Allen

unread,
May 28, 2001, 3:20:56 AM5/28/01
to
Peter Geddes wrote in message
...snip

> The batch files sent give a Windows Beep
> (chimes.wav), not a BIOS like beep.

AFAIK, in a Windows DOS box, the ASCII=7 character,
which is what I generated, activates the "Default" sound
if you have configured one.

If you don't have one set, as I usually don't, the ASCII=7
character activates a BIOS-like beep.

Start, Settings, Control Panel, Sounds Applet, "Default Sound"
and set it to what you please, or remove the assignment
altogether to hear the BIOS beep.

I assume you have the Default Sound set to CHIMES.WAV.

Since the default sound is usually stored in the registry here:
[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\.current]
@="C:\\PathTo\\FileWithSound.WAV"

you could probably change it dynamically in a batch script
if you needed the script to use a different sound (and reset
it as the script ends).

--
William Allen


0 new messages