Simple coloured output from CMD.EXE

It’s stupid to have to post this, but it’s even more stupid that the function isn’t built in.

Suggestions on the glorious Internet are just nasty: use PowerShell or use hacks around other built-in functions.

Instead, I’ve thrown together a 10KB C++ console app that starts and exits almost instantly.

To use it, you simply pipe what you want to display to the executable. You pass in one or two heaxdecimal digits as a parameter and that colours the output accordingly:

screenshot_colourecho

You can use the colour values in the wincon.h header file. These are fairly limited, so you may be best off trying the various values. The first value is the background and the second is the foreground. Not all values are supported for the background.

 

The code and executable are available here:

https://app.box.com/s/nnyv082efsiedhl2rrxw0qs761jm9t1w

 

 

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