How to get a better Windows command-line
Being one of those Luddites that uses both Windows and the command-line, I’ve managed to setup a tolerable command shell and window. There are plenty of resources out there about Cygwin, bash, 4NT, Putty, Console, tab-completion and fonts etc. but here’s what you need to do to get this:
(259k)
The short version
- Buy (or trial) JPSoft’s 4NT as a replacement for the cmd.exe prompt.
- Configure it to taste.
- Download Console as a replacement for the cmd.exe window. I prefer the 1.5 release.
- Download a good fixed-width font: ProFontWindows, Consolas or Monaco for example.
- Setup your Console windows with a few different configurations.
- Download some essential and useful command line tools: GNUWin32 (for the Unix stuff - download the lot) and PsTools (for Windows administration)
- Add the install directories to your 4NT path.
- Profit! Alternatively, watch time pass you by as you play on the command-line.
Why should I pay for 4NT?
Many Windows command-prompt users are fans of Cygwin (specifically the bash prompt). It’s good but my primary annoyance is that Windows drives appear as subdirectories: C:\ becomes /cygdrive/c/ for example.
This means you can’t use a Windows path (e.g. c:\windows\system32) without first converting it to a Cygwin path: /cygdrive/c/windows/system32. Needless to say this quickly becomes tedious. Pretend you’re editing a file in Windows. You know it’s in c:\work\mywork.py. You can’t jump into cygwin and type: python c:\work\mywork.py. What if that script takes a file path as an argument? Should I pass a Windows path or Cygwin path?
There are various [painful] workarounds for this but 4NT has been designed to run on Windows and knows it’s running on Windows, so there’s consistency. You can work with standard Win32 program builds without modification; almost all useful Unix tools have a Win32 binary available. Colour coding, powerful batch commands, filename completion, good support and more (press F1 in the shell to see) for around £40 - well worth the spend.
Why use Console?
There are a few problems with the standard Windows command prompt window:
- The copy-and-paste implementation is lacking.
- The fonts are ugly.
- Resizing the window is tedious.
- It doesn’t support Windows XP or Vista themes.
- I can’t have a Donald Duck background or make it transparent or (more sensibly) keep it always-on-top or stick it to the desktop.
Thankfully, Console solves all these problems. I use version 1.5 as the tabbed-windows in 2.0 don’t appeal to me. So what does Console do?
- You can configure copy to work in several ways. Left-click or shift+left-click and drag to select text. By setting Console’s copy_on_select option, your selection is copied as soon as you release the mouse button. CTRL+V to paste, as usual.
- Simple and multiple configuration files, all accessible by right+click on the Console window for different window sizes, fonts, backgrounds etc.
- Support for Windows themes.
- Act as a normal window, pin-to-desktop or always-on-top.
Spend some time perusing the readme.txt and learning Console’s config options. You configure it using simple XML files and you can have several configurations. Get Console using 4NT as the command prompt by either changing the COMSPEC environment variable or (my preference) editing the ’shell’ attribute in the <console> element in Console’s configuration file.
Why the obsession with Unix tools?
This is why we want to use the command-line, right? find, grep, less, tail, head, wc, wget, lynx etc. You’re limiting yourself if you stick to the built-in Windows commands (although 4NT does provide a number of enhancements).
Is there more?
Python programmers would probably like ipython. It’s an excellent interactive shell for Python which many people also use as a replacement for cmd.exe. ipython in Console is attractive and works very well.
(When installing ipython on Windows, make sure that you install readline.)
There’s also the new Windows Powershell. I’ve never used it but Windows administrators rave about it. I’m not sure how useful it is for software developers.
More:
- Published:
- 09.06.07 / 7am
- Category:
- windows
7 Comments
Jump to comment form | comments rss [?] | trackback uri [?]