Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've done quite a bit of powershell scripting, and it has some warts but overall it's actually pretty good.

  * You have access to the entire .Net standard library
  * Optional typing
  * Writing functions and using pipes allows a functional style
  * You can even inline some C# code, or read it from a separate file and compile it on the fly. I've used that to make windows API calls (P/Invoke).
Overall, I'd choose pwsh scripting over bash any day, and I'd say it doesn't even make me miss python all that much (for simple scripts, couple hundred lines max).

The main feature lacking for larger scripts/tools is classes, I think. Unless it has changed in newer versions, powershell is object-oriented yet does not allow you to define custom classes, which is annoying to say the least. The workaround is loading c# on the fly.



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

Search: