4 ms·
I spent some time with Powershell on Windows recently, more time than I am used to. Powershell is a clear winner over CMD.EXE by a mile, but… - As an interacti
by klodolph 7y ago
I spent some time with Powershell on Windows recently, more time than I am used to. Powershell is a clear winner over CMD.EXE by a mile, but…
- As an interactive shell, it suffers from an ecosystem which is much poorer than the bash/zsh ecosystem,
- As a scripting language, I’m going to use Python or Go the moment anything becomes larger than a few lines,
- Installing Posh Git is just a really mediocre experience (indicative of various, more specific problems)
Some of these things can be fixed up, like the bad experience installing Posh Git—you have to update the package manager to a non-release version, but the signature is occasionally broken (it seems to happen again and a gain) so you have to disable signature verification, and then you can use the updated package manager to download the Posh Git package.
Through the journey I encountered so many stupid random problems that it’s not something I can just step out and recommend to anyone. I’ll continue using it as my primary shell on Windows, but for various reasons (I forget the exact details) I had to give up on it for working with Git. There was a lot of “action at a distance”, like running ssh-agent would break the “ls” alias for Get-ChildItem, which leaves me high and dry without muscle memory.
Meanwhile, Microsoft is also spending time and money on WSL. Again, I’ll still be using PowerShell on Windows but even there it is a damn rough experience. The command-line has been paradoxically a second-class citizen as well as a necessary tool for development on Windows for as long as I can remember, and it will take a lot more improvement to PowerShell before that feeling disappears.
- ct520 7y agoyeah I use to automate a decent amount of stuff for bigger deployments for client with it as it’s easier to pass through security audit then an executable. I always feel like things in power shell are harder then they need to be that other scripting languages I don’t have that problem. One thing I do like is being able to leverage .net locally and also import DLLs. That helps me get around a bunch of gaps.
- beart 7y agoMy biggest issue with powershell is how undiscoverable it is. Good luck doing anything without searching for commands in a web browser. But maybe that's just a result if it being so new. 'ls' has been around for almost 50 years... What it really feels like is a complete programming language inside of notepad.exe because of the historically terrible windows command prompt.
- nsomaru 7y agoYes, but, POSIX shells aren’t that much more discoverable, either. It takes loads of reading and trial and error to become competent in any command line.
- minusf 7y agoI would argue that the strict posix shell (with all its limitations) can be learnt in an afternoon or two and a lot of it will be also useful in general in the OS. like utilities and their inputs and outputs. it's mostly reusing/duct taping existing programs, so it's not a vacuum like a DSL. I hope it has excellent man pages to be usable. the BSDs have...
- solarkraft 7y agoThe worst/easiest to fix discoverability problem with Microsoft prompts is that they show you a single completion on tab and cycle through them on every subsequent tab, which is a lot more confusing than being shown all the options, in my opinion.
- tonyedgecombe 7y agoI'm sure it's fine if you live in it all the time but if you only use it occasionally it becomes hard work.
- noisem4ker 7y agoI'd say it's not any less discoverable than the typical Unix shell, plus readability is guaranteed when coming across scripts written by someone else. Crypticism is culturally out of place in Powershell, and I think this is its best feature. PS: the ISE (Integrated Scripting Environment) helps when writing scripts.
- Legogris 7y ago> But maybe that's just a result if it being so new. 'ls' has been around for almost 50 years... Even so, I don't think we can use that excuse given that it was released over 13 years ago...
- 7y ago
- backslash_16 7y agoHey, I use PowerShell on Windows a lot. Some advice that I hope helps for installing posh-got specifically is to “git clone” the posh-git repo. Then in your $Profile.CurrentUserAllHosts do an Import-Module for the PSM. I know all this is personal and subjective. I think using git to manage this is pretty easy and safe. If and when I want to update it’s as simple as doing a git pull in my local repo of posh-git and reloading the shell. If the new version is broken (has never happened yet but ya know.. in case) just checkout the previous one. I have found using git, the powershell user profile and modifying my user path when necessary is the best way of managing dev dependencies on Windows. I also understand why people want this all abstracted away from them in a package manager.
- rezeroed 7y agoFor scripting, if you use Python and Go, give Nim a try.
- klodolph 7y agoNo.
- dr-detroit 7y ago>its too hard to type gci or actually know what you're doing in a file system and use something like get-item "path\partialmatch*" I cant relate to your problems
- auxym 7y agoI'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.
- pdpi 7y ago> - As a scripting language, I’m going to use Python or Go the moment anything becomes larger than a few lines, The point is very much that with powershell this move is to C#, with a much nicer integration with the shell.