Hacker News new | past | comments | ask | show | jobs | submit login

As someone who occasionally has to write PowerShell, I can say with confidence that is an abomination of a language with a horrible syntax. I hope this never gets implemented on any other platform when there are so many superior alternatives.



Really? Log onto Windows and run:

    ps OUTLOOK.EXE | kill
Note the lack of any regex-munging tools? That's because PS is sending a list of processes, not just lines of text. The constant Unix 'what's a good regex for this or that' problem is gone because content is separate from presentation - which as we all know is good engineering.

I'm a Unix guy. Window Server 2008R2 still requires reboots for trivial activity (eg, installing Office web), which I don't think is appropriate for servers. But PoSH is awesome.


I too am a Unix guy, but I came from a very Microsoft centric world: Microsoft itself. There, I used PowerShell day in and day out. It's a decent little shell. I much prefer it over cmd! That said, a better description for it would be a REPL. And if you think about it that way, then it's a pretty damn awful shell. It prefers to work with objects, so it tends to be frustrating to work with bytes. Besides, I've already got a great tool for working with objects: Python.

The bottom line is this: If you need a tool for operating on objects, then use a programming language; preferably choose one with a strong REPL. If you need to deal with persistent, serialized, streams of bytes, use a traditional shell.


I agree snprbob86, and that's what I was getting at. PowerShell doesn't know if it's a shell or an object-based language.

It's far too verbose. It's a shell, and a huge pain to type interactively. Yes, it has tab completion, but so does bash - and that's far less verbose.

It's also opaque. Because it's object-based, but you work with it on the command line, it outputs in text but there is constantly "other" information that is not displayed on screen that you can get if you pipe through to another command. That's not intuitive. Text processing is intuitive.

It reeks of design by committee. It's own execution policy. Java-like getter/setters. Super verbose syntax. About the only good thing PowerShell has done is force Microsoft to provide a command-line, scriptable interface to all their server products to get away from GUI dependency. And that's a product of their PowerShell internal policy, not the language itself.

Yes, it's better than CMD.exe. But still a huge pain. Other platforms have Python, Ruby, Perl... and dare I say it, bash.


Is it really all that verbose? The full cmdlet names like Get-ChildItem etc. are long, but there are standard abbreviations for most of them - which follow a more consistent naming pattern than short names in most languages/shells.


Is there a reason why Bash or *nix shells in general aren't popular on Windows?


I've heard a lot of good things about it, mainly from people used to CMD though. When I checked it out, I didn't find a lot to do with it. I didn't feel like learning a new shell language that only works on Windows. The lack of familiar helper tools such as diff, grep and sed didn't help, and I don't know whatever Windows equivalents may exist. I'm sure if I was using Windows PWSH would be great, but like many of us I don't have any interest in using Windows as a webserver platform.

Now that there may be a prospect of using PowerShell on other platforms, I wonder why I'd bother? Day to day tasks I'm perfectly happy doing in bash, and anything more complex, I'd just as soon use Python, Ruby, PHP or Perl.


grep is Select-String

diff is an alias for Compare-Object so if you tried it, you should have seen it do something. But unlike actual diff it operates on objects rather than files, so you need to gc (Get-Content) the files you want to compare.

sed/awk: string manipulation is built-in to PowerShell, but sed's in-place file editing is replicated by piping Get-Content into Set-Content. Sometimes more verbose, sometimes not.

I personally don't see what value PowerShell would bring to other platforms, given they already have huge swathes of scripts written in well-developed (or at least well-discussed) languages and command-line tools for system administration are plentiful. But why would you bother using Perl when you already have Ruby? Obviously some people will take the choice if they know it.


What is it about the syntax that you dislike? I am neither for or against, I just have friends that use it quite frequently and seem fine with it.


And bash is so much superior ?


Superior alternatives such as...?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: