Comment Re:Not enough people that use powershell commentin (Score 1) 110
So... PowerShell is a scripting language with a shell attached?
Obviously not, since the ability to run scripts is disabled by default.
There's a script I need to run on my machine every now and then, and it requires me to log in as admin. Under CMD, I can just launch it with the Ctrl-Shift-Enter trick. Under PowerShell, the way I have to do it is launch the shell and type, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process'
You can also just Ctrl-Shift-Enter PowerShell too. The Set-ExecutionPolicy you are running is not about running as admin, but about running scripts at all. Your example has been limited to just the current Process, so it will not be saved. If you just removed the Scope specifier altogether then it would be saved for the local machine. You would never have to type that in again (although you would still need to Ctrl-Shift-Enter to do administration tasks).
As a shell, it's still bloated, overly complicated, and confusing.
It definitely took a while to really grok the change of mindset when coming from bash. The extra long parameter names annoyed me at the start, until I realised how useful it is to be able to just tab through the parameters on the command line and effectively get documentation as you go because of how descriptive they are. For example, the option to Select-String (aliased to sls for short) for -NotMatch is far more obvious to what it does than grep's -v. However, it is not much different from grep's --invert-match which is the long form of the same parameter.
They also follow a consistent pattern so that once you get to know the way command names work, then you can often just guess what another command will be.
It was also confusing about how the pipeline worked, coming from bash's "everything is text" mentality. But after a while there will be a point where the full power of it will suddenly hit you. Elsewhere here I wrote a two-line script in response to a challenge to someone saying that it would be more bloated than the four-line bash script. (I didn't even try to optimise it - it was just the first way that I thought of doing the task in PowerShell.) But as I was going to post it, I realised that the full power of the shell came from the fact that the script that I wrote was also much more useful just by the nature of how the objects and pipeline worked. I could output my script to other commands to manipulate the files that were listed. To do this in the similar output from the bash script would have required parsing the text to get the filenames back and then looking up the files again.
And the commands that I could pipe my script's output to were the same ones that I used to sort and filter the output of a database query (without having to go query it again) and of an imported CSV file. While PowerShell being fully self-contained with commands seems very much against the idea of Unix, its ability to use the same commands in a wide variety of applications is very much the epitome of it.
Finally, I find it amusing how so many people complain that Microsoft (sorry, M$) just copies Unix, but when they do produce something that is genuinely different everybody complains about how complicated it is and that they should have just used bash. Most of the people here who have criticized it have just used vague reasoning without any examples of the problems they found. Most of the time they demonstrate a complete lack of understanding of the language. At least you gave a specific example, and for that I applaud you.