I want to play a beep sound if a copy operation fails.
copy C:\Amethyst\Original.docx C:\Backup
if %ERRORLEVEL% NEQ 0 (
echo
)
The sound always plays.
I want to play a beep sound if a copy operation fails.
copy C:\Amethyst\Original.docx C:\Backup
if %ERRORLEVEL% NEQ 0 (
echo
)
The sound always plays.
(Translated from French)
Hi,
What you ask is not directly feasible with CMD ... but with NIRCMD.exe it is possible !
Download Here
1) Unzip
nircmd.zip
2) Move the 3 files (nircmd.exe, nircmdc.exe, nircmd.chm) into C:/Windows/System32
For the beep, there are several solutions:
-
nircmd stdbeep
will play the default Windows beep-
nircmd beep [Frequency] [Duration]
will play a beep with a frequency of [Frequency] Hz for [Duration] milliseconds-
nircmd mediaplay [play time] [audio file]
will play [audio file] for [play time] millisecondsI hope I answered your question
Yassin