Fun DOS tip

I’m sure nobody writes batch files any more, right?

Well unfortunately I need to as part of our unattended POS system installation.  I was recently trying to clean up scripts and was irritated by the number of duplicate lines, one for writing to a log and the other for displaying to the screen.  After a few minutes of playing around and a couple of Internet searches I came up with the following:

ECHO %DATE% – %TIME% – The action succeeded or failed, blah, blah, blah >> %LOG% >&2

Very convenient for removing extra lines of code that cluttered the script.