litany against fear

coding with spice ¤ by nick quaranto

Pimping the Windows Command Line

published 20 Mar 2008

Lately I’ve noticed that a few of my friends have been able to understand or even be aware of the Windows command line. I have a hard time myself pulling myself away from Explorer, but sometimes the command line is just quicker. However, it’s a bit drab by default. Today I’m going to show you just how you can pimp yours out a bit.

First up is a wonderful tool called Console2, which is an open source tabbed command line utility. It allows easy configuration of fonts, colors, the background colors, and even lets you do some really crazy things if you wanted such as adding a background image. The best feature by far though are its tabs, which I’m sure if you’ve ever used IE7+ or Firefox you know how useful they can be for multitasking. Another great feature is that you can set up plenty of keyboard shortcuts if you’re into that sort of thing. Check it out here: http://sourceforge.net/projects/console/

Console is great if you want to fire up a specific program all the time, but I’m used to slamming WinKey + R and typing cmd so much that it’s basically embedded into my muscle memory. So, I was looking for configuring the default prompt instead of running another program. Pimping out my command prompt has taken me quite a while to find the perfect configuration that suits my needs, and it’s constantly changing as I find new things to add. Here’s what I’ve done to trick mine out:

I’m using Consolas as my font. I absolutely love Consolas and I find it much easier to read than Courier New or the default font that the command window has. Consolas is not available by default and requires a simple registry hack along with a reboot in order to work. I haven’t had any issues with it thus far, and I highly recommend following Scott Hanselman’s wonderful tutorial.

I’m not a Windows command line user at heart, I was raised during my Computer Science classes to poke around Linux machines. Sadly, certain commands like ls -la come much more naturally to me than dir /a. My solution to this is installing the CoreUtils for Windows package, which adds most of the core GNU utilities into the command line. This hack requires installing a package from SourceForge and adding to the PATH environment variable, which are covered in this blog post over at AskStudent.com.

Finally, I’m a huge fan of using the pushd/popd commands: push directory and pop directory. Basically it’s a way to return to directories instead of having to overuse cd or even remember where you were. Luckily, there’s an easy way to keep track of the amount of directories that have been pushed onto the stack by changing the PROMPT environment variable to:

$p$_$+$g

Check out the AskStudent tutorial to see how to do get to the environment variables window if you don’t know how. What this does is add + symbols to the command line window as shown in the screenshot. It’s ridiculously useful, and now I just wish I could figure out how to automagically pushd and cd at the same time.

If you’ve got any questions regarding pimping out your command line or other great hacks I’m missing out on, let me know!



email twitter github