6 ms·
Powershell is so damn good and is probably so because it was not improvement of cmd. Give credit where it is due.
by manojlds 14y ago
Powershell is so damn good and is probably so because it was not improvement of cmd. Give credit where it is due.
- shadowmint 14y agoI'm always found it difficult to read and impossible to debug. It's useful, sure, but nice? I'm not convinced. How about an empty recycle bin command? Why, certainly, you can do that: $Shell = New-Object -ComObject Shell.Application $RecBin = $Shell.Namespace(0xA) $RecBin.Items() | %{Remove-Item $_.Path -Recurse -Confirm:$false} Teh F33243ck. Readable much? I sure hope your powershell scripts come with comments; the one's we've inherited sure didn't and they're black magic.
- oblio 14y agoThat's because they don't have nice, human readable COM (and WMI) wrappers. I don't think they had time to implement them - they kept adding more and more from v1 to v2 and v3. Every time you have Win32 spilling over in Powershell, it looks like crap (0xA).
- lake99 14y agoOver here, on Linux-land, I used to have PS-envy whenever I thought about the PowerShell. You cured me! Though I don't use Trash/Recycle myself, to contrast, I like the simplicity of rm -rf ~/.local/share/Trash/info ~/.local/share/Trash/files
- manojlds 14y agoCommands like Remove-Item have familiar aliases like rm by default. If you see code in tools like Psake, etc. it would be very verbose, because the intention is to have readable code. But you sure can use the aliases for everyday use.
- tomovo 14y agotell application "Finder" empty the trash end tell
- iso8859-1 13y agoIn GNOME: dbus-send --print-reply --dest=org.gnome.Nautilus \ /org/gnome/Nautilus \ org.gnome.Nautilus.FileOperations.EmptyTrash
- ksk 14y agoI agree, Powershell is definitely uglier to look at. To shorten it a bit you could also do this.. gci \'$Recycle.Bin' -Force -Recurse | ?{-not $_.PSIsContainer} | Remove-Item -Force
- frozenport 14y agoWould be better if people actually used it!
- fungi 14y agoi love my windows sys admin co workers... really lovely guys! but there is no way in hell they can/ever will or want to write powershell.
- skrebbel 14y agoI really can't agree with that. To me, Powershell feels like it was designed by geniuses and implemented by interns. Absolutely basic stuff, like "find the path of this file" (%~dp0 in batch) is a 5 line copy-paste. Why? It's lovely that I can pipe .NET objects places, but every time i want it to actually do something, I end up in copy-paste hell.
- wfunction 14y ago> Powershell feels like it was designed by geniuses and implemented by interns. As an intern I find this slightly offensive. ;)
- shadowfox 14y agoNow I am curious :) I thought you just needed to do something like: $(ls $PSCommandPath).Directory (Not that that isnt longer than %~dp0; but I am curious what the 5 lines actually does)
- skrebbel 13y agoAt the time, I ended up googling for something like: function Get-Script-Directory { $scriptInvocation = (Get-Variable MyInvocation -Scope 1).Value return Split-Path $scriptInvocation.MyCommand.Path } I found that [1] lists a one-liner too, but that's also a four-liner if you'd turn it into a function. Still, I can't remember that shit by heart. I don't want to. Why do I have to? Did these people ever even use Powershell themselves? [1] http://stackoverflow.com/questions/5466329/whats-the-best-way-to-determine-the-location-of-the-current-powershell-script http://stackoverflow.com/questions/5466329/whats-the-best-wa... Sidenote: if something like node.js, entirely designed for fast asynchronous networking, despite all its callback hell and whatnot, is a better and more user-friendly Windows scripting host than Powershell, some people really should start to worry. Maybe if Powershell had something like npm, including its (simply perfect) install-to-current-directory-by-default, people could fix all the holes MS left behind. I might even start to like it then.
- Cakez0r 14y agoI don't understand why they felt the need to defy standards with powershell. It's not similar to anything else i'm familiar with. All they had to do was copy bash and port some of the GNU tools.