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

Windows 2000 Beep in Batch File

48 views
Skip to first unread message

Michelle Hillard

unread,
Nov 20, 2003, 7:27:43 AM11/20/03
to
Guys,
I know this is easy for you.
But I dont understand how to make the computer beep in a batch file. I want
to use some control character ascii thing but dont know how to do this.
Any ideas?

--


---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com

robi

unread,
Nov 20, 2003, 7:33:48 AM11/20/03
to

"Michelle Hillard" <mhil...@craized.tv> wrote in message
news:3r2vb.19136$aT.1...@news-server.bigpond.net.au...

> Guys,
> I know this is easy for you.
> But I dont understand how to make the computer beep in a batch file. I
want
> to use some control character ascii thing but dont know how to do this.
> Any ideas?


echo ^G


Michelle Hillard

unread,
Nov 20, 2003, 7:37:54 AM11/20/03
to
Thanks Robi,
I tried this but it didnt work.

If I simply put this line in a batch file, should it beep?
For some reason it doesnt. Running XP.
Do I need to do something else?

--


---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com


"robi" <rob...@ciachgazeta.pl> wrote in message
news:bpicbe$fai$1...@inews.gazeta.pl...

robi

unread,
Nov 20, 2003, 8:02:32 AM11/20/03
to

"Michelle Hillard" <mhil...@craized.tv> wrote in message
news:CA2vb.19164$aT.1...@news-server.bigpond.net.au...

> Thanks Robi,
> I tried this but it didnt work.
>
> If I simply put this line in a batch file, should it beep?
> For some reason it doesnt. Running XP.
> Do I need to do something else?
>

try this
1. create file bell.txt cantainig string ^G (or ^G^G^G)
2. in batch flie do: type bell.txt

Michelle Hillard

unread,
Nov 20, 2003, 8:07:36 AM11/20/03
to
Thanks for your help
Still cant get it working
I must be dumb

--


---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com


"robi" <rob...@ciachgazeta.pl> wrote in message

news:bpie18$m0n$1...@inews.gazeta.pl...

Pegasus (MVP)

unread,
Nov 20, 2003, 8:12:12 AM11/20/03
to

"Michelle Hillard" <mhil...@craized.tv> wrote in message
news:CA2vb.19164$aT.1...@news-server.bigpond.net.au...

Some editors won't let you enter ^G (e.g. notepad.exe). You
can get around the problem by doing this:
- Create c:\test.bat with notepad.exe:
@echo off
echo
- Save & close the file
- Type this:
echo Ctrl+G Ctrl+G Ctrl+G>>c:\test.bat
- Reopen test.bat with notepad.exe
- Place the black blocks after the "echo" on the second line.
- Save & close
- Run the batch file


robi

unread,
Nov 20, 2003, 8:17:47 AM11/20/03
to

"robi" <rob...@ciachgazeta.pl> wrote in message
news:bpie18$m0n$1...@inews.gazeta.pl...

^G is in fact hold down alt key and press 7 from numeric keyboard, then
relase both keys - it will display ^G on screen.
Best way to create bell.txt is doing this from command prompt:
copy con bell.txt [Enter]
alt-7 [Enter] (display ^G)
F6 [Enter] (displays ^Z - end of input)


Michelle Hillard

unread,
Nov 20, 2003, 8:37:30 AM11/20/03
to
Thank you so much to both Robi and Pegasus.
You guys are the best, thank you.

--


---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com


"Pegasus (MVP)" <I....@fly.com> wrote in message
news:bpieib$2mim$1...@arachne.labyrinth.net.au...

Uno

unread,
Nov 20, 2003, 8:46:50 AM11/20/03
to

"Michelle Hillard" <mhil...@craized.tv> wrote in message news:3r2vb.19136$aT.1...@news-server.bigpond.net.au...
> Guys,
> I know this is easy for you.
> But I dont understand how to make the computer beep in a batch file. I want
> to use some control character ascii thing but dont know how to do this.
> Any ideas?


echo X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$^^PTXSW9#vylkkt>beep.com
echo kvqvqynosvkkukqymousowqymooylqwknkqylqvvswkktvzzzztoprxzvoprrzoy>>beep.com
echo lqomwzqylqovwoxwlmnw >>beep.com
beep
beep


Source:

mov al, 182
out 43h, al
mov ax, 2560

out 42h, al
mov al, ah
out 42h, al
in al, 61h

or al, 00000011b
out 61h, al
mov bx, 200
.p1:
mov cx, 65535
.p2:
dec cx
jne .p2
dec bx
jne .p1
in al, 61h

and al, 11111100b
out 61h, al


Matthias Tacke

unread,
Nov 20, 2003, 9:34:00 AM11/20/03
to
Uno" wrote:
>echo X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$^^PTXSW9#vylkkt>beep.com
>echo kvqvqynosvkkukqymousowqymooylqwknkqylqvvswkktvzzzztoprxzvoprrzoy>>beep.com
>echo lqomwzqylqovwoxwlmnw >>beep.com
>beep
>beep
>
Hello Uno,
nice program. I don't wnat to restart a recent discussion, but when I
compare the source with an unassemble of beep.com it is obvious that
something is missing. I assume there is an org different from 0100 and
a header not shown.

>Source:
>
>mov al, 182
>out 43h, al
>mov ax, 2560
>
>out 42h, al
>mov al, ah
>out 42h, al
>in al, 61h
>
>or al, 00000011b
>out 61h, al
>mov bx, 200
>.p1:
>mov cx, 65535
>.p2:
>dec cx
>jne .p2
>dec bx
>jne .p1
>in al, 61h
>
>and al, 11111100b
>out 61h, al
>

==============================================================
C:\>dump beep.com
0000: 58 35 30 32 35 30 33 50 5F 35 3A 53 29 45 38 2C : X502503P_5:S)E8,
0010: 77 50 2D 51 5F 50 35 72 33 35 3B 34 50 2D 2B 4A : wP-Q_P5r35;4P-+J
0020: 50 35 4A 53 2D 57 24 50 68 6B 78 68 2D 6B 2D 24 : P5JS-W$Phkxh-k-$
0030: 27 24 5E 50 54 58 53 57 39 23 76 79 6C 6B 6B 74 : '$^PTXSW9#vylkkt
0040: 0D 0A 6B 76 71 76 71 79 6E 6F 73 76 6B 6B 75 6B : ..kvqvqynosvkkuk
0050: 71 79 6D 6F 75 73 6F 77 71 79 6D 6F 6F 79 6C 71 : qymousowqymooylq
0060: 77 6B 6E 6B 71 79 6C 71 76 76 73 77 6B 6B 74 76 : wknkqylqvvswkktv
0070: 7A 7A 7A 7A 74 6F 70 72 78 7A 76 6F 70 72 72 7A : zzzztoprxzvoprrz
0080: 6F 79 0D 0A 6C 71 6F 6D 77 7A 71 79 6C 71 6F 76 : oy..lqomwzqylqov
0090: 77 6F 78 77 6C 6D 6E 77 20 0D 0A : woxwlmnw ..
Dump beendet.
C:\>debug beep.com
-r
AX=0000 BX=0000 CX=009B DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=0CFF ES=0CFF SS=0CFF CS=0CFF IP=0100 NV UP EI PL NZ NA PO NC
0CFF:0100 58 POP AX
-u
0CFF:0100 58 POP AX
0CFF:0101 353032 XOR AX,3230
0CFF:0104 353033 XOR AX,3330
0CFF:0107 50 PUSH AX
0CFF:0108 5F POP DI
0CFF:0109 353A53 XOR AX,533A
0CFF:010C 294538 SUB [DI+38],AX
0CFF:010F 2C77 SUB AL,77
0CFF:0111 50 PUSH AX
0CFF:0112 2D515F SUB AX,5F51
0CFF:0115 50 PUSH AX
0CFF:0116 357233 XOR AX,3372
0CFF:0119 353B34 XOR AX,343B
0CFF:011C 50 PUSH AX
0CFF:011D 2D2B4A SUB AX,4A2B
-q
==================================================================
Which is different from your source. So people who don't believe have
difficulties to prove correctness of the com file.
No offense meant. _I_ think ascii asm is a useful.
--
Greetings
Matthias

Uno

unread,
Nov 20, 2003, 12:25:31 PM11/20/03
to

"Matthias Tacke" <Matt...@Tacke.de> wrote in message news:bpijcm$gd$01$1...@news.t-online.com...

I've furnished the exact source but the com file is encoded.


Herbert Kleebauer

unread,
Nov 20, 2003, 1:42:27 PM11/20/03
to
Uno wrote:
>
> "Matthias Tacke" <Matt...@Tacke.de> wrote in message news:bpijcm$gd$01$1...@news.t-online.com...
> > Uno" wrote:
> > >echo X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$^^PTXSW9#vylkkt>beep.com
> > >echo kvqvqynosvkkukqymousowqymooylqwknkqylqvvswkktvzzzztoprxzvoprrzoy>>beep.com
> > >echo lqomwzqylqovwoxwlmnw >>beep.com
> > >beep
> > >beep
> >
> > >Source:
> > >
> > >mov al, 182
> > >out 43h, al
> > >mov ax, 2560
> > >
> > >out 42h, al
> > >mov al, ah
> > >out 42h, al
> > >in al, 61h
> > >
> > >or al, 00000011b
> > >out 61h, al
> > >mov bx, 200
> > >.p1:
> > >mov cx, 65535
> > >.p2:
> > >dec cx
> > >jne .p2
> > >dec bx
> > >jne .p1
> > >in al, 61h
> > >
> > >and al, 11111100b
> > >out 61h, al
>
> I've furnished the exact source but the com file is encoded.

No, here is the disasembled source:

1fd9 : 00002ea7 br.b $2eaa (eb 01)
1fd9 : 00002ea9 nop (90)
1fd9 : 00002eaa move.b #$b6,r0 (b0 b6)
1fd9 : 00002eac out.b r0,#$43 (e6 43)
1fd9 : 00002eae move.w #$0a00,r0 (b8 00 0a)
1fd9 : 00002eb1 out.b r0,#$42 (e6 42)
1fd9 : 00002eb3 move.b m0,r0 (8a c4)
1fd9 : 00002eb5 out.b r0,#$42 (e6 42)
1fd9 : 00002eb7 in.b #$61,r0 (e4 61)
1fd9 : 00002eb9 or.b #$03,r0 (0c 03)
1fd9 : 00002ebb out.b r0,#$61 (e6 61)
1fd9 : 00002ebd move.w #$00c8,r3 (bb c8 00)
1fd9 : 00002ec0 move.w #$ffff,r2 (b9 ff ff)
1fd9 : 00002ec3 dec.w r2 (49)
1fd9 : 00002ec4 bne.b $2ec3 (75 fd)
1fd9 : 00002ec6 dec.w r3 (4b)
1fd9 : 00002ec7 bne.b $2ec0 (75 f7)
1fd9 : 00002ec9 in.b #$61,r0 (e4 61)
1fd9 : 00002ecb and.b #$fc,r0 (24 fc)
1fd9 : 00002ecd out.b r0,#$61 (e6 61)
1fd9 : 00002ecf move.b #$4c,m0 (b4 4c)
1fd9 : 00002ed1 trap #$21 (cd 21)
1fd9 : 00002ed3 rts.w (c3)

You didn't mention the unnecessary branch at the beginning,
the exit code and the unnecessary ret instruction. But your
delay loop is real funny: the length of the sound is inverse
proportional to the processor speed.

But as I already have said, you shouldn't use this decoder routine.

- because of the escaped ^ character the program will crash in DOS/Win9x

- if there is an extra space at the end of a line the code will fail

- this method uses 2 ascii characters for 1 binary byte and therefore
generates unnecessary large code

Or is this an attempt to bring discredit to ASCII assembler programming?

Uno

unread,
Nov 20, 2003, 2:10:52 PM11/20/03
to


Ops ,here is the correct com file:

X502503P_5:P)En-whP,QP5rH5;TP-{IP-kB-kTP-*BP-hc-iZP5O35JTP-za-eB
QP-{X,}P-_s$DPh;y-0m-(jP-!\P-5O-JAPh^$TZSXSW9$Oght+Ki(P*tKK]st\K
tSW+)tISims(izfzMXizMX^xtSKDzt*ShNEnC


>But your
> delay loop is real funny: the length of the sound is inverse
> proportional to the processor speed.

Who cares?

> But as I already have said, you shouldn't use this decoder routine.
>
> - because of the escaped ^ character the program will crash in DOS/Win9x
>
> - if there is an extra space at the end of a line the code will fail
>
> - this method uses 2 ascii characters for 1 binary byte and therefore
> generates unnecessary large code
>
> Or is this an attempt to bring discredit to ASCII assembler programming?

No I'm a beginner!


Uno

unread,
Nov 20, 2003, 2:18:38 PM11/20/03
to

> - this method uses 2 ascii characters for 1 binary byte and therefore
> generates unnecessary large code

With CM3.COM:

`h}aXP5y`P]4nP_XW(F4(F6(F=(FF)FH(FL(Fe(FR0FTs*}`A?+,
fkOU):G*@Crv,*t$HU[rlf~#IubfRfXf(V#fj}fX4{PY$@fPfZsZ$:I}n$*P
09;n}perxK/~s7B*f)}?8he9,p1{6+2UzO6f8rZ/lqs:;R:j}WRX]'=v@{,M
y~#

181 bites

With mine:

X502503P_5:P)En-whP,QP5rH5;TP-{IP-kB-kTP-*BP-hc-iZP5O35JTP-za-eB
QP-{X,}P-_s$DPh;y-0m-(jP-!\P-5O-JAPh^$TZSXSW9$Oght+Ki(P*tKK]st\K
tSW+)tISims(izfzMXizMX^xtSKDzt*ShNEnC

169 bites


Herbert Kleebauer

unread,
Nov 20, 2003, 2:49:24 PM11/20/03
to
Uno wrote:

> Ops ,here is the correct com file:
>
> X502503P_5:P)En-whP,QP5rH5;TP-{IP-kB-kTP-*BP-hc-iZP5O35JTP-za-eB
> QP-{X,}P-_s$DPh;y-0m-(jP-!\P-5O-JAPh^$TZSXSW9$Oght+Ki(P*tKK]st\K
> tSW+)tISims(izfzMXizMX^xtSKDzt*ShNEnC

Great, now you have replaced the ^ character in the decoding routine
by two ^ in the encoded data. You also use a ! which is a problem
when delayed expansion is enabled in Win2k/XP. You also must take
care, that there is no separator character followed by a digit as
the last character in a line before the redirection symbol >.

Why didn't you just replace the ^ character in your original code
by a ~ character?

X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$^PTXSW9#

X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$~PTXSW9#


> With CM3.COM:
> 181 bites
>
> With mine:
> 169 bites

Yes, your decoding routine is very compact. So for very small
programs your over all size is smaller. But for larger programs
the cm3 encoded size is only 5/8 of your size.

Mark V

unread,
Nov 20, 2003, 2:53:38 PM11/20/03
to
In alt.msdos.batch.nt Michelle Hillard wrote:

> Thank you so much to both Robi and Pegasus.
> You guys are the best, thank you.
>

It seems you have your solution. I was about to suggest that your
computer might have shipped with no "bell". Some systems may have a
sound card chip and no built-in speaker in which case you may need a
workaround. Another problem in some MS OSs could be that the beep.sys
driver is disabled. You can also use .wav files from batch by several
methods if desired.

Todd Vargo

unread,
Nov 20, 2003, 4:49:47 PM11/20/03
to

"Herbert Kleebauer" wrote:
> Uno wrote:

> > I've furnished the exact source but the com file is encoded.

> But as I already have said, you shouldn't use this decoder routine.


>
> - because of the escaped ^ character the program will crash in DOS/Win9x

Thanks very much for the heads-up Herbert!

--
Todd Vargo (body of message must contain my name to reply by email)

Uno

unread,
Nov 21, 2003, 6:25:02 AM11/21/03
to

> Why didn't you just replace the ^ character in your original code
> by a ~ character?
>
> X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$^PTXSW9#
>
> X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$~PTXSW9#

Yes:

X502503P_5:S)E8,wP-Q_P5r35;4P-+JP5JS-W$Phkxh-k-$'$~PTXSW9#kvqvqy
nosvkkukqymosskyqymooylqwkrkqylqvvswkktvzzzztoprxzvoprrzoylqomwz
qylqovwoxwlm


barabashka

unread,
Nov 21, 2003, 6:40:11 PM11/21/03
to
Is there way to make remote computer beep?

Mark V

unread,
Nov 22, 2003, 10:32:55 AM11/22/03
to
In alt.msdos.batch.nt barabashka wrote:

> Is there way to make remote computer beep?

Open an interactive session on the remotes system and issue ^G
(psexec.exe for example) ...but who would want to?

Or was it a joke?


barabashka

unread,
Nov 24, 2003, 1:01:37 PM11/24/03
to

What I want to do is receive some distinct sound signal (3 beeps for
instance) on comp2 after remote batch completed on comp1.
Batch initiated and executed on comp1.

Problem with psexec is hardcoded password will be exposed in the batch
file.

B.

Mark V

unread,
Nov 25, 2003, 7:11:39 AM11/25/03
to
In alt.msdos.batch.nt barabashka wrote:

Maybe stick a
NET SEND
in that file at the end...

0 new messages