3

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

I ended up using this:

Echo | set /p=“Ctrl+G”

Where ctrl+g is the Bel character.

| improve this answer | |
1

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.