6 ms·
They have powershell for that.
by serge2k 10y ago
They have powershell for that.
- mtdewcmu 10y agoThey said themselves that PowerShell is not a replacement for Cmd...
- Ericson2314 10y agoNot a literal replacement, but no they want you to use PowerShell instead of CMD (and for good reason).
- mtdewcmu 10y agoI get that they want to push PowerShell.
- throwaway7645 10y agoI've been using Powershell a lot lately. I keep hoping I'll get the hang of it, but everything sucks. It gives you Compare-Object, but what it returns is an object. Even if I waste 10 minutes converting it to text and want to then split the strings it returns there is a 99% chance it won't work. Sure it is great for automating a few IT things like installing new users, but the problem is it shouldn't be that hard. In bash I would just pipe the output of diff to Awk and simply split on "," and tell it to print what I want. I'm sure it is possible in Powershell, but the 6 ways I tried never worked.
- sixothree 10y agoSame here. Every time I've completed a script I can't help but think I could have finished it so much faster in C# or just about any other language. I tried liking it. Maybe I'm just not finding the right useful examples.
- romwell 10y agoI also like that a system touted for comprehensibility and discoverability has the following very commonly used command: Get-ChildItem Guess what it does by looking at its name. Correct, it lists the contents of a directory! What else could it be? Conversely, if you want to find out what "dir"/"ls" would be in PowerShell, where else would you be looking! I like the idea of PowerShell a lot (object-oriented piping), but I hope it evolves into something with saner default aliases and better documentation, with easy things accomplished easily.
- RandomOpinion 10y agoFrom a basic data structures class in college, one might recall that nodes in a tree have can have child nodes. Filesystems, most of them anyway, are structured as trees of files and directories. Therefore one would expect a command named "Get-ChildItem" executed against the current directory to do...? (Aside from that, the Powershell default alias set translates both "dir" and "ls" to Get-ChildItem.)
- yomritoyj 10y agoGet-ChildItem also works on things other than directories. And Powershell understands both ls and dir!
- throwaway7645 10y agoIt knows ls, but there are a lot of UNIX commands it doesn't and it isn't a true implementation, but an alias for running Get-Childitem.
- ygra 10y agoYes, the point is to get started easily if you're used to another environment, not to be able to use it as a cmd or bash replacement.
- detaro 10y agoConversely, if you want to find out what "dir"/"ls" would be in PowerShell, where else would you be looking Not so hopeless (although if you ask for detailed docs it opens a browser for you,internet required): PS C:\Users\xxx> help ls NAME Get-ChildItem SYNTAX Get-ChildItem [[-Path] <string[]>] [[-Filter] <string>] [<CommonParameters>] Get-ChildItem [[-Filter] <string>] [<CommonParameters>] ALIASES gci ls dir
- mtdewcmu 10y agoI wanted to play around with PowerShell, but the learning curve looked a bit too steep.
- hug 10y agoI suspect that this is not a case of Powershell "sucking" but it being a tool that is completely unfamiliar to you. You say you run compare-object and you're surprised that it returns an object; Powershell is essentially an object-oriented pipeline, so a return object should always be the expected case. You say is that it's hard to coerce the object into a text-stream that you can munge, but again I suspect that your difficulties are again a misunderstanding of exactly how you should be operating in Powershell. Even me saying "coerce the object into a text-stream" is disingenuous, because what you'll end up with is almost always going to be `string[]`. Once you've thrown away all of the data contained in the object except for the one string property you want, you've thrown away all of the value of Powershell. None of this difficulty is your fault. In bash you would "just" pipe the output of `diff` into `awk`, but that "just" is a cop-out: bash is nearly as complex as Powershell itself before you throw awk into the mix. You already know awk and bash, so it's natural to you and all of your preconceptions about how the shell should work are met. Powershell is entirely capable of doing what you want to do with it, but it's a completely different world. If you persist with it, and you do get the hang of it, I promise you'll understand the value of the concepts behind it.
- throwaway7645 10y agoTrue to a degree, but I only had to put a few hours into bash and I haven't found anything I can't do. I've spent a fair amount on PowerShell and keep running into hurdles. I found no less than 5 ways to add text from a certain process to a file. PS did it, but something like 800x slower than Python and Perl. The only fast way I can find is a direct C# implementation in PS using streams. Why so harsh? There is a lot I like such as being able to build GUI's faster than anything out there (except Red or Rebol), but the language fights you at every step. I was aware that mostly everything was supposed to be an object. This is great for certain IT work, but just adds complexity for others. I have to then hunt for properties I want like "-property name" and it usually ends up as another rabbit hole.
- tremon 10y agoI suspect that this is not a case of Powershell "sucking" but it being a tool that is completely unfamiliar to you. Maybe, but I still want to make the case that Powershell sucks: - Function return values. WTF were they thinking when they decided it was useful when the result of a function is an array of every statement result within that function? And why isn't there a useful way (like, say, "return") that overrides that behaviour? - Automatic unboxing and splatting of arrays. If I have a list of one element, I want to know that I have a list of one element. If I ask for the Length of that array, I do not want to know the length of that single element (which is not 1, in the case of a list of strings). - Case sensitivity. Sorting in Powershell is always case-insensitive, except when it isn't (when you use a .Net sort algorithm instead of Sort-Object). Still, Get-Unique is always case sensitive, as is Select-Object -Unique. Of course, you can get case insensitive uniqueness by using Sort-Object -Unique. - The -AsString weirdness. Multiple Powershell commands can process String lists, and know they're processing String lists, but they will still return their results as Strings wrapped in PSObject. This leads to very fun results when you're trying to use those results as HashTable keys. I've lost days debugging this madness, especially when coupled with the implicit autoboxing I mentioned above.