CryEcho: Examples of use
CryEcho is a free command line utility which displays messages to standard-out, but without automatically adding a newline. It is intended for use in batch files.
Examples of things you can do with CryEcho:
Simple dot line to show activity
Displaying a dot every now and then is a very simple technique to show progress on a long running batch file. Then animated gif to the left shows what the end effect can look like.
To implement this simply add:
CryEcho .
after each section in the batch file.
The animated gif above was based on the following batch file:
@echo off
rem Example showing how to use CryEcho to produce a dot line to show activity.
cryecho .
call :DoSomeWork
cryecho .
call :DoSomeWork
cryecho .
call :DoSomeWork
cryecho .
call :DoSomeWork
cryecho .
call :DoSomeWork
cryecho .
call :DoSomeWork
cryecho .
call :DoSomeWork
cryecho .
call :DoSomeWork
cryecho \n
echo Finished.
goto :eof
:DoSomeWork
ping -n 2 localhost > nul
goto :eof
Spinning wheel
A spinning wheel is another technique to show activity during a long running batch file. In this case a spinning wheel is made up of the characters "-", "\", "|" and "/". Each time the next character in the sequence is printed it is followed by a backspace which allows any other printing to simply overprint the wheel.
There are a number of different ways this could be implemented. The simplest would be to add each of:
CryEcho -\b
CryEcho \\\b
CryEcho -q "|"\b
CryEcho -\b
through out the batch file.
Note the -q when printing the bar ("|"), this is because without the quotes DOS treats the bar as a pipe. The -q flag simply strips away the quotes.
In practise this becomes a headache when making changes to the batch file. The following script (on which the animated gif above was based on) makes a call to give the appearance of a spinning wheel:
@echo off rem Example showing how to use CryEcho to produce a spinning wheel to show activity. CryEcho Working ... call :DoSomeWork call :SpinAlive call :DoSomeWork call :SpinAlive call :DoSomeWork call :SpinAlive call :DoSomeWork call :SpinAlive call :DoSomeWork call :SpinAlive call :DoSomeWork call :SpinAlive call :DoSomeWork call :SpinAlive call :DoSomeWork call :SpinAlive call :DoSomeWork cryecho \s\nFinished. goto :eof :DoSomeWork ping -n 1 localhost > nul goto :eof :SpinAlive if "%Spinner%" == "2" ( cryecho \\\b ) else if "%Spinner%" == "3" ( cryecho -q "|"\b ) else if "%Spinner%" == "4" ( cryecho /\b set Spinner=0 ) else ( cryecho -\b set Spinner=1 ) set /A Spinner=%Spinner%+1 goto :eof