Which hex value does "beep" when echoed at the cmdprompt?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
pstein
Posts: 125
Joined: 09 Nov 2011 01:42

Which hex value does "beep" when echoed at the cmdprompt?

#1 Post by pstein » 25 Aug 2014 01:05

Sometimes I output lots of text stuff with "Echo" at the cmdline.

And it occurs occasionally that a "beep" can be heared.

So it seems to me that this is a hidden, invisible control char somewhere embedded in the text.

Exactly which hex value causes the command prompt to beep when its echoed from a batch script?

Peter

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Which hex value does "beep" when echoed at the cmdprompt

#2 Post by ShadowThief » 25 Aug 2014 02:46

07, otherwise known as the Bell character

Yury
Posts: 115
Joined: 28 Dec 2013 07:54

Re: Which hex value does "beep" when echoed at the cmdprompt

#3 Post by Yury » 25 Aug 2014 09:40

Code: Select all

@echo off

forfiles /m "%~nx0" /c "cmd /c echo 0x07"

for /f %%i in ('forfiles /m "%~nx0" /c "cmd /c echo 0x07"') do set BEL=%%i
echo %BEL%



or


Code: Select all

@echo off

mshta "vbscript:CreateObject("Scripting.FileSystemObject").GetStandardStream(1).Write(Chr(7))&Close()"| more

for /f %%i in ('mshta "vbscript:CreateObject("Scripting.FileSystemObject").GetStandardStream(1).Write(Chr(7))&Close()"') do set BEL=%%i
echo %BEL%



.



For Windows 8 (?), Windows 8.1:


Code: Select all

@echo off

forfiles /m "%~nx0" /c "cmd /c echo 0x07"
timeout /t 1 /nobreak>nul

for /f %%i in ('forfiles /m "%~nx0" /c "cmd /c echo 0x07"') do set BEL=%%i
echo %BEL%
timeout /t 1 /nobreak>nul



or


Code: Select all

@echo off

mshta "vbscript:CreateObject("Scripting.FileSystemObject").GetStandardStream(1).Write(Chr(7))&Close()"| more

for /f %%i in ('mshta "vbscript:CreateObject("Scripting.FileSystemObject").GetStandardStream(1).Write(Chr(7))&Close()"') do set BEL=%%i
echo %BEL%
timeout /t 1 /nobreak>nul



.

Post Reply