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
Which hex value does "beep" when echoed at the cmdprompt?
Moderator: DosItHelp
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Which hex value does "beep" when echoed at the cmdprompt
07, otherwise known as the Bell character
Re: Which hex value does "beep" when echoed at the cmdprompt
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
.