Sqlplus is my second home, part 3: Colored selections in Windows XP command prompt

Whenever delivering some Oracle training or running a demo at a conference, I’ve always liked to use the Windows command prompt version of sqlplus.

One reason of course is its easy command line history navigation capability ( press F7 in cmd.exe after entering few commands to see why ).

Another reason is that whenever I want to highlight some part of sqlplus output, I can just drag a selection rectangle around that text. In other words I can “mark” the text – drawing the attention there. Of course as the selection rectangle is really meant for copy & paste operations only, it has several limitations. It’s not persistent, whenever I continue typing, the text “marking” will disappear.

Windows XP has introduced a really cool feature to cmd.exe, which anyone doing presentations involving some command line tool output will appreciate!

Basically XP allows you to persistently select and color command prompt output!

An example of what I’m talking about is here:

How can this be done?

First, you need to create a DWORD value in Windows registry HKEY_CURRENT_USER\Console\EnableColorSelection and set it to 1

Now launch CMD.exe, select something and press CTRL+6. The backround of text of the selection should turn red. If you press ALT+6, the foreground text should turn red.
You have 10 different colors available for your use, using key-combinations ALT+0..9 and CTRL+0..9

Also, this coloring is persistent. If you generate more output during your demos, you can always scroll back and easily spot the highlighted part quickly if need to revisit some previous result.

Nice huh? I will sure use it in my future demos and presentations!

If you want my whole CMD.exe registry key settings, copy and paste the these lines below into a .reg file and import into your registry ( after backing up your current key of course! ).

Windows Registry Editor Version 5.00

"FaceName"="Lucida Console"

I’ve configured multiple CMD.exe things from defaults for my convenience. Most of the stuff is accessible from the CMD.exe Properties menu, however the EnableColorSelection and WordDelimiters need to be set in registry.

The WordDelimiters is another handy setting. It allows you to specify where in the typed line cursor stops should you navigate left or right word-by-word using CTRL+Left/Right arrows. Normally only the space char was recognized as a word delimiter, but I’ve added many other characters as well – it’s much faster to navigate on command line that way.

NB! After a 1.5 year break, this year’s only Advanced Oracle Troubleshooting training class (updated with Oracle 12c content) takes place on 16-20 November & 14-18 December 2015, so sign up now if you plan to attend this year!

This entry was posted in Cool stuff and tagged , . Bookmark the permalink.

4 Responses to Sqlplus is my second home, part 3: Colored selections in Windows XP command prompt

  1. tanelp says:

    Note that I updated the .reg file contents just now and put back the backslashes the wordpress editor had stripped previously…

  2. Sidhu says:

    Good one Tanel

    A new thing for me, really nice :)


  3. Dan says:

    Good stuff! This will definitely be helpful when doing presentations or teaching a class. Thanks for summarizing it so nicely.

  4. Satish says:

    Interesting feature!

Leave a Reply

Your email address will not be published. Required fields are marked *