Monday, January 17, 2011

Windows Command-Line tips (and UI ramblings)

Just a little quick tip I stumbled across which I thought would be of interest to Windows users out there.

From Windows Vista onwards (?  I'm not sure about Win7 though...), you can bring up a command-line prompt with its current directory set to be any folder on your computer by simply:
Shift-RMB on a folder, and choosing "Open Command Window Here"
Finally I might not need to create command-prompt shortcuts all around the place (though with my mouse's dodgy RMB, which is probably on its way out, with its frequent accidental double-clicks, I might still keep them for some rainy-days), or try and look for an alternative to the old Powertool for WinXP.

This functionality is particularly useful for developers and power-users, who frequently need (or want) to use command-line tools to perform certain tasks faster. For instance, it's a lot faster than starting a shell and starting to 'cd' around, typing out fully (or directory jumping via tab-completion), or setting up some command-line aliases (IMO it's a pain to do this for too many directories as it gets confusing fast and hogs up all the short space for other stuff which is comparatively rarer; i.e. I only reserve these for commands/programs nowadays).

Anywhoo, getting back to this tip. It's still not as nice as just being able to RMB on any folder and being able to fire up a shell (as on Linux), but at least it's there.

Oh BTW, one other thing that's nicer on Linux is "focus follows mouse", which though off by default, is IMO usually a better way of working as it allows a more fluent user experience. This is because most people will move their cursor around the screen to where they are focusing on with their eyes (i.e. where their attention is), so making the window under the mouse have focus makes it more efficient for the user to simply start typing and have those events get sent to where they intended.

Of course, this can be dangerous (i.e. password prompts), where a mouse going walkabout midway could be a serious security risk. Mouse walkabout problems also pose a minor annoyance for users working in a less-than-optimal environment (i.e. mouse on pile of loose books or sitting on lap), though we'd like to think that nobody "should" be doing anything too critical and for too long periods in such environments for their own Health and Safety (TM).

On my Linux account at Uni, I've had this enabled for the past year (or more), and it is really does make things much better when working with multi-window situations (i.e. several text editors and shells laid out side by side, as well as a few file browsers too).

Buoyed by this experience, I've tried setting this up on my Windows laptop at home (you'll need to hack your own software to call some underlying Windows API's to do this, or fiddle with your registry manually IIRC). However, this was what could best be summed up as a "mega-fail". Perhaps it's just Windows having a crappy window manager (despite its name suggesting otherwise, if you ignore all the other background history here), or perhaps it's something more fundamental.

I suspect that this is probably the relative over-reliance and abundance of overlapping dialogs and prompts and "other small popup windows" as the primary means of interaction. Now, these dialogs all show up in the center of the screen, but that's not always where the mouse is at the time when the dialog was invoked. Hence, in the process of getting your cursor to the new dialogs in question, you inadvertently give all the dialogs stacked in between focus, as your cursor crosses each of their boundaries in turn. In some cases, this results in the latest popup actually getting covered, as the larger dialog behind it gets focus and is brought up to the top.

Sadly (depending on your viewpoint), this is yet another case where Linux just does it better. Having said that, there are times and places for both :)


  1. One source of annoyance for me has been that the shift+rmb -> "Open command window here" doesn't work when you're using a Library view in Windows 7. The option just isn't there. =/

  2. Back in the day (Windows 95 and some with NT and XP) I used to use a collection of utilities call the Microsoft PowerToys that provided both the "command prompt here" context menu option and Xmouse to make the mouse behave like on a Unix system.

    Sadly it looks like they no longer support this in Vista/7, but these were my favorites when I used Windows as my primary desktop at home, but used Solaris and Irix at work. I've been mostly blessed with the option of not using Windows most of the time for work since about 2000.

    Supposedly you can get this to work with some sort of registry hack as well:

    But I don't have a Windows machine handy to mess with this at the moment.