Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
The / vs `\` difference is system-wide. A shell cannot magically change it. (Besides, Windows NT already allows forward slashes.) –  grawity Nov 10 '09 at 19:51

11 Answers 11

up vote 25 down vote accepted

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.

share|improve this answer
    
PowerShell ISE (Integrated Scripting Environment) also supports unicode display, so any of those scripts that generate unicode text output works well. –  samt Jun 2 '09 at 3:42
1  
P.S. Powershell is Free. Powershell supports forward-slash path names. Where's my BONUS POINTS!?!? ;-) –  Ryan Fisher Jun 2 '09 at 21:40
    
I agree with most of this. But I don't agree that it is object orientation that results in these advantages. Powershell is closer to functional programming rather than object oriented: in your examples get-QADUser and sort-object aren't methods attached to an object via a class, and piping like this features in functional languages like F#, but not OO. –  RD1 Oct 8 '10 at 1:56
    
Both of the cmdlets I used as examples return a collection of objects (based on .Net objects). My example specifically demonstrates how one can manipulate such a collection using a property of an object class common to the objects in the collection. This is different and superior to the "string based" manipulation of data available in other shells. ALL shells are going to look like functional programming at the command-line, but whatever you call it the fact is that you can deal directly with the objects themselves within Powershell. –  Ryan Fisher Oct 20 '10 at 19:31
    
Excellent answer for a similar question on PowerShell from Jeffrey Snover ( Powershell developer for Microsoft ). stackoverflow.com/questions/573623/#573861 –  Ryan Fisher Oct 20 '10 at 19:35

Poweshell. Nuf said. :)

share|improve this answer

I'm pretty sure cmd allows forward slashes.

Have you looked at Powershell? People seem to swear by that.

share|improve this answer

Windows Powershell is great, easy to install and is going to come with Windows 7. You even can write cmdlets which are very similar to bash scripts.

I've been an Ubuntu user for about 3 years now and I loved it.

share|improve this answer

I'll have to join the powershell chorus. Unlike a unix style shell, cmdlets all use a pipeline of objects that flow from one cmdlet to another. This means that you don't have to worry about figuring out how to make one cmdlet work with another. In the unix world most shell command and scripts spend gobs of code stripping out the "extra text" that the next command can't deal with. It also means that the more you learn about it the more you can use it. Unlike a typical shell where you have to learn how each command works so you can figure out how to transform the piped text, powershell cmdlets work the same regardless of input. Eg if I send a directory list to select-object (which chooses specific properties to use) select-object works the exact same way if I send it an active directory user object, an SCOM management class or an exchange mailbox.

Take a look at And Now for Something Completely Different:Introducing Windows PowerShell

share|improve this answer

Why did you abandon Cygwin? What sort of problems did you experience with Cygwin? While I have only dabbled with powershell, I have used cygwin for several years and find that it's POSIX utilities are a must on wintel machines, not to mention all the services like SSH client and server, and X-windows. All for free.

share|improve this answer
    
Cygwin is way too big (if you just want a shell) but it is easy to install. I use it daily. –  gbarry Jul 6 '09 at 7:08

Mike's right, there is always Hamilton C shell. (I wrote it! :) And I can happily report that I released a major revision just literally days after Mike's observation that it didn't appear to have updated recently. This latest build now fully supports Vista and Win7 and you get both 32 and 64-bit binaries.

To answer your specific questions:

  1. Yes, it includes all the usual suspects, history, command line editing, filename and command completion, aliases, background processes, etc., plus many enhancements such as built-in and user-defined procedures, block-structured variables, expressions with floating point and improved wildcarding (e.g., a "..." construct to mean zero or more directory levels, as required to make the pattern match.) It also includes a fairly complete set of all the usual built-in and external utilities such as more, ls, grep, sed, head, tail, diff, xargs, sort, chown, tar, etc. (The only things of importance I don't include are awk, perl and vi, for which authoritative, free versions for Windows already exist.)

  2. It's very simple to install. Just open the standard XP and Vista-compatible Windows Installer .msi file and you're good to go. The entire user guide is installed as hypertext. It's completely well-behaved, so uninstalling through the control panel also works exactly as it should, removing everything. (You won't find any junk left behind in the registry or elsewhere.)

  3. Sorry, it's not free. Price is $350 here in the US but I do give discounts for students and in certain other situations. (I really don't want cost to be problem, so if it's going to be, please reach out to talk to me. I'm a regular person like you not some huge corporation.)

  4. Yes, you can use either forward or backward slashes. And you can set the escape character to be either a Windows-style circumflex(^) or a UNIX-style backslash().

I am the sole author. It's all my own work, all of it written completely from scratch for Windows. I go straight to the Win32 API for everything (I don't even bother with the C runtime except to sprintf stuff because the CRTL hides things like error codes) so it's both very fast and it really understands Windows. Internally it's implemented as a true, multithreaded top-down recursive descent compiler architecture, so even though it's a C shell, you can rest assured it does not have any of the problems often complained about in the original UNIX C shell.

If you'd like to take a closer look, I do have free demo versions on my website so you can certainly try it before you buy. And it comes with an unconditional satisfaction guarantee, so if buy and change your mind, you can return it for any reason or even for no reason at all and get your money back.

If you have questions at all or I can help in any way, just send me mail at hamilton@hamiltonlabs.com or give me a call at 425-497-0102. As I said, I am real person and I do answer the phone. I hope this was helpful.

share|improve this answer
    
Since writing this almost 4 years ago, I've gotten an actual account here (you'll see me more often in superuser.com) and reduced the price for Hamilton C shell. For personal use, it's now just $89 and that covers all your personal machines. I've also made the free version genuinely useful. (It used to have a 10-command limit. It no longer has any limit.) –  Nicole Hamilton Feb 22 '13 at 17:45

http://win-bash.sourceforge.net/ <- if you are already used to bash style.

share|improve this answer

There's always the Hamilton C Shell, but it looks like it hasn't been actively updated in the last year or so.

share|improve this answer

Have you actually looked at cmd.exe recently? Since at least as far back as Windows XP it supports all of your requirements aside from / instead of \ (so no bonus points but otherwise it's fine).

share|improve this answer

Adding the contents of unxutils to your path is what works best for me.

For many years now. So you are still in an original dos box, thus no emulator-ish strings attached.

grep, ls, du, it's pretty much all there, you may have to hunt for some extras like a 'curl.exe'.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.