I want to play a beep sound if a copy operation fails.
copy C:\Amethyst\Original.docx C:\Backup
if %ERRORLEVEL% NEQ 0 (
The sound always plays.
(Translated from French)
What you ask is not directly feasible with CMD ... but with NIRCMD.exe it is possible !
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] milliseconds
nircmd beep [Frequency] [Duration]
nircmd mediaplay [play time] [audio file]
I hope I answered your question