Using the Bel Character in cmd (the CTRL+G character) I can make a sound in my batch file. However, because of how that works, it makes a new line. Is there a way I could not make a new line when making the sound?
2 Answers
I ended up using this:
Echo | set /p=“Ctrl+G”
Where ctrl+g is the Bel character.
Check this link - the good thing is that is a copy-paste-able code without need of obscure characters that can be misinterpreted:
@echo off
setlocal
::Define a Linefeed variable
set LF=^
::above 2 blank lines are critical - do not remove.
call :hexprint "0x0B" BEL
echo --%BEL%--
exit /b
:hexPrint string [rtnVar]
for /f eol^=^%LF%%LF%^ delims^= %%A in (
'forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c echo(%~1"'
) do if "%~2" neq "" (set %~2=%%A) else echo(%%A
exit /b