4 ms·
PowerShell is almost like using the python interactive interpreter as your command line but better. I was convinced how cool it was when I could import a C# .dl
by pshposh 10y ago
PowerShell is almost like using the python interactive interpreter as your command line but better. I was convinced how cool it was when I could import a C# .dll and load the types into PowerShell. You can even just write C# 'inline' and it compiles it on the fly.
It baffles me as well how many Windows people I work with ignore it almost.
- NoGravitas 10y agoThis is really the best analogy to explain PowerShell to Unix people. PowerShell's sweet spot is really not interactive use, but sysadmin-type scripting. It's very much like using Python for sysadmin tasks.
- Too 10y agoSo essentially it's a programming language? For "scripting", why would I use it over just plain c#?
- paulmooreparks 10y agoBecause C# is designed around application development, whereas the PowerShell scripting language is designed around scripting and its peculiarities.
- WorldMaker 10y agoIt's about like asking why would you use F# or (Iron)Python over C#? Different syntaxes have different strengths/weaknesses and the trade-offs can target different use cases and needs. At the end of the day it's whatever makes you (feel) productive. In terms of specifics, PowerShell's strengths over C# for scripting are particularly in PowerShell's the ability to succinctly navigate hierarchies (folders, but also other folder-like trees) in a way reminiscent of shells from time immemorial, as well as to easily interleave native binary calls (and pipes/redirects/captures). Some of it is the difference between grabbing C# binding for libgit off NuGet, LINQing my way through a the git DAG for the information I need versus running `git show xyz` or `git describe` directly in a shell and capturing that into a variable or piping that to whatever my next steps are. Depending on my level of abstraction and how often that script is called and if I'm paid to write that script or it is getting in the way of what I'm actually trying to work on, I use a different tool for the job.
- swah 10y agoFor starters, I would look into it if it had a different look like ConEmu (fonts, themes, fullscreen)
- xemoka 10y agoIt does? You can run powershell in ConEmu—I run it in cmder.