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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s