Windows – A decent command-line shell for Windows

shellwindows

Surely someone has written a decent shell for Windows.

I'm looking for

a) something more or less like the ordinary linux shell (ie. history, completion etc.)

b) something which is a simple install (easier than Cygwin which didn't seem all that good when I tried it.)

Bonus points if it's :

c) Free (as in speech)

d) Allows forward slashes instead of back-slashes in paths

Best Answer

Powershell has a SIGNIFCANT advantage over any of the other command shells. It is OBJECT ORIENTED.

In cmd, bash, etc. your output from a command like dir/ls is a effectively a string array. If you pipe tha tto another command then you have to process strings. In Powershell the dir cmdlet actually gives an array of file objects that you can pipe to another command and act on those objects via properties. Powershell is really an interactive .Net shell. Every cmdlet is actually a wrapper around a set of .Net objects.

All the next generation of management interfaces coming from Microsoft are actually implemented in Powershell and the GUI interfaces are a wrapper around the Powershell commands, similar to the "Unix way" of doing GUI admin tools.

Here's an example from an Active Directory perspective... You can use the cmd.exe shell and a utility like dsquery.exe to do LDAP queries for objects. But you get a list a distinguished names back. You can then process those DNs as string, etc. In Powershell v1 or v2, you can install and use a Quest snap-in that gives you tools like get-QADUser. When you query the AD with get-QADuser the return values are a collection of User objects. So a command like:

$users = get-QADUser svc_*

Will return a a collection that you can process by property, for example to sort them by HomeDirectory you would use:

$HmDirs = get-QADUser svc_* | sort-object HomeDirectory

There is no other shell out there that has this capability for Windows. Powershell is the way to go, absolutely.

Update: PowerShell v2 is now released as part of Windows Management Framework, but if you want to get the Microsoft AD cmdlets, you have to be running server 2008 R2 or Windows 7, else it's still the Quest cmdlets.