This page is edited from the 1cmdfaq.txt faq-file contained in
my tscmd.zip
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
companion.
Please see "
The Description and
the Index page" for the conditions of usage and other such
information.
92} How do I play a sound or a tune from the command line?
The simplest way to emit a brief beep is
@echo <Ctrl-G>
How to enter the ASCII 7 character depends on your editor program.
One fairly common way of entering the beep character is entering 007
from the numeric keypad while holding down the ALT key. Or you could
even put the character as follows in a file and copypaste it from
there.
gawk 'BEGIN{printf "%%s","\x07"}'>beepchar.txt
or
gawk 'BEGIN{printf "@rem %%s\n","\x07"}'>>myfile.cmd
If you can get hold of
QBASIC it has a
PLAY statement. For example
@echo off & setlocal enableextensions
set bas_=%temp%\tmp$$$.bas
for /f "tokens=*" %%f in ("%bas_%") do set bas_=%%~sf
> %bas_% echo PLAY "l8 o3 cdefgab o4 cd"
>>%bas_% echo SYSTEM
qbasic /run %bas_%
for %%f in (%bas_%) do if exist %%f del %%f
endlocal & goto :EOF
The Sound Recorder can be used to play a Wave Audio Sound file
(.WAV). For example
sndrec32.exe /play /close %SYSTEMROOT%\Media\tada.wav
or, without displaying the Sound Recorder window on the desktop
start /min "" sndrec32 /play /close %SYSTEMROOT%\Media\tada.wav