Re: Microsoft only have themselves to blame
"The verbosity, though, means you can actually usually take a correct guess at the command you're after, and its parameters, without having to Google what you're attempting to achieve."
I'm glad that works for you. It doesn't work for me. I usually have no clue what a command is called, and I am often very baffled about how I'm supposed to extract parts of the results. I have to wonder if part of the reason you know these things is not that it's so clear and standard, but that you've used it enough that most things you want to do frequently you've already seen--while you may not have memorized them, you can take guesses based on having seen them before.
The problem with PowerShell is that it's intended both as a CLI system and a programming language. Not a scripting language, but a programming one. Meaning lots of things like exceptions and type confusion which can be harmful. Consider how a user interacting with it as a CLI sees certain elements. An easy example is error messages. Let's compare some error messages printed by unix tools and PowerShell commands:
Listing a nonexistent directory:
[email protected]:~$ ls /doesnotexist
ls: /doesnotexist: No such file or directory
PS C:\>ls c:\doesnotexist
ls : cannot find path 'C:\doesnotexist' because it does not exist.
At line:1 char:1
+ ls c:\doesnotexist
+ CategoryInfo : ObjectNotFound: (C:\doesnotexist:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Copy a file onto itself:
[email protected]:~$ cp file1 file1
cp: file1 and file1 are identical (not copied).
PS C:\>copy file1 file1
Copy : Cannot overwrite the item C:\file1 with itself.
At line:1 char:1
+ copy file1 file1
+ CategoryInfo: WriteError: (C:\file1:String) [Copy-Item], IOException
+ FullyQualifiedErrorId : CopyError,Microsoft.PowerShell.Commands.CopyItemCommand
Yes, the information is there. The error messages are possibly a little better, in fact. But the rest of the data is useless and it gums up the output stream. It's all there because people are expected to run these commands in scripts and catch these things. Well, let's say I'm writing a script to copy things and I want to catch the copy-onto-itself bug for some reason. What do I catch? Look at that error printout from earlier. Is it WriteError? IOException? CopyError? Which of these can I even catch? What else might cause that but not be this particular error? Is there a CopyFileOntoItselfException?
None of that is obvious. An easy method to find out is to go online. What if I don't want to? Well, on a unixy OS, I can do "man cp" for a full log or just run cp with no arguments to get a summary. What about PowerShell? Maybe just "copy" will do the trick:
cmdlet Copy-Item at command pipeline position 1
Supply values for the following parameters:
Nope, that's not it. Might they have made a man command for me? Yes, they have. While we're on the subject, I'm noting here that the only way I can find commands is by entering their unix versions and seeing if someone at PowerShell HQ has linked them to me. While get-help is not that hard to guess, I could see several other options such as get-documentation, describe-command, show-manual, and various other things.
Let's try "man copy". It pulls up a typical man page, except the basic one doesn't really say anything. It talks quite a bit about the command being able to copy and rename a file in one command because well, duh, but it spends only a couple terse lines talking about parameters and doesn't mention errors or exceptions. There are two other views, detailed and full, and maybe one of those contains that information. Detailed doesn't. Full doesn't. Finding out that neither does takes reading long man pages with very long examples sections.
So if I want to use it as a method of launching things, I end up having to see plenty of pointless details that only matter if I'm writing programs. If I'm writing programs, I have to hunt the internet for information about what a command can do. They should start with a good CLI and build the scripting onto that, but they didn't. It shows.