📜 ⬆️ ⬇️

Useful tips: beep in the Windows console

I often have to run quite long operations from the command line. For example, Maven build or tests. Naturally, you quickly get tired of admiring the “Matrix”, and switch to some other tasks. However, I want you to be immediately informed that you can continue to work. By default, the Windows console does not provide the ability to assign a beep to complete the operation. But the answer is simple.

You can only add to the team a small addition.
For example, in the batch file that causes the bild, you can write this:
call mvn process-resources war:exploded & c:\programms\MPlayer\mplayer.exe "d:\programms\res\ok.wav" > nul
Now, after running mvn, mplayer starts and loses ok.wav, and it doesn't add extra garbage to the console (because of "> nul"). Naturally, you can use any other player, or just call “ok.wav”, then the default player will start, but I like the player because without a guy.

For convenience, you can make the call of sounds into separate bats, and put somewhere where the path is registered, then they can be called for other commands. You can make two batch files for successful completion and for error, respectively.
So:
build.bat
call mvn process-resources war:exploded && success.bat || fail.bat

success.bat:
@c:\programms\MPlayer\mplayer.exe "d:\programms\res\sucess.wav" > nul

fail.bat:
@c:\programms\MPlayer\mplayer.exe "d:\programms\res\error.wav" > nul

Having run the build, you can no longer switch to the console, we already know when the process is over, and successfully or not.

Well, in the end we are doing! .Bat with the following content:
@%* && success.bat || fail.bat

Now you can run any command:
! copy very_big.file, and hear the result.
')
Sounds can be taken from the standard Windows, or any other. I like these TSCUpd00.wav , TSCErr01.wav .

Windows XP Redirection

I do not pretend to be the discoverer of America, if someone knows an easier way - share.

Source: https://habr.com/ru/post/112490/


All Articles