News for hackers. Stuff that matters.
Re:Chocolatey - Windows Package Manager by pizza on Sunday October 09, 2011 @08:21PM (#3091754)
What benefits (other than what looks like a scripting language) does PowerShell give over regular command prompt?
Re:Chocolatey - Windows Package Manager by iamelgringo on Sunday October 09, 2011 @11:15PM (#3092135)
Differences between PowerShell and other *nix shell variants are that PShell allows you to pipe full COM or .NET objects between processes or commends, rather than just piping the text files between different commands.

PowerShell vs cmd.exe PowerShell is actually a complete shell scripting language, that gives you full access to all of the .NET libraries and methods. It also has a rather nice IDE that ships with Windows as is. Also, you can use PShell of Exchange and other server automation, you can do remote scripting, and it has some pretty decent security controls baked into the system.

Re:Chocolatey - Windows Package Manager by lloeki on Monday October 10, 2011 @04:29AM (#3092846)
> PShell allows you to pipe full COM or .NET objects between processes or commends, rather than just piping the text files between different commands.

Which is IMHO the best part about unix shell and the worst about PowerShell: being pure text, unix shell allows for very loose definition of the interface between the program and outside, allowing to connect stuff in creative ways with minimal plumbing; whereas PowerShell makes this interface definition quite stringent by comparison, hence needing theoretically less plumbing (at least for simple tasks) but requiring far more design in the interface, restricting connectivity which in turns generates more mediation and plumbing to connect foreign elements.

In short unix shell may seem archaic but its loose binding makes it very powerful and quick to solve problems, while PowerShell is, well, a chore.

Re:Chocolatey - Windows Package Manager by comex on Monday October 10, 2011 @08:11AM (#3093412)
I haven't used PowerShell (since I don't use Windows), but when using the Unix shell interactively every so often I find myself in a situation where the data is too complex for a shell command to be able to process it, or else running into some corner case of missing functionality. Usually I end up piping into python -c, but that ends up pretty gross... if PowerShell isn't the answer, what is?

I wonder how far you could get by sort of plopping PowerShell onto the Unix shell and supporting both structured and text data.

(Incidentally, one such corner case is summing a list of numbers - this sounds like it should be a short command, but actually requires a complicated command line using awk.)

Re:Chocolatey - Windows Package Manager by malkia on Monday October 10, 2011 @12:10AM (#3092257)
Complete yes, but slow to start up (takes hundredths of ms, even if hot-loaded), and not very syntax friendly.
Re:Chocolatey - Windows Package Manager by recoiledsnake on Monday October 10, 2011 @12:45AM (#3092309)
Hundredths of ms sounds pretty fast
Re:Chocolatey - Windows Package Manager by malkia on Monday October 10, 2011 @01:43PM (#3094879)
Yes, it's okay if it's started once, but if you have to run it over and over then it's not. For example run it 10000 times, and if time it takes 300ms - you are looking at an hour of execution. Some apps (even if they are big) are just naturally cached by the OS in the file system buffers, but others are doing quite of other things before running.

If this is going to be a "shell" replacement it needs to start very fast at least in hot mode (cached).

Re:Chocolatey - Windows Package Manager by mhitza on Sunday October 09, 2011 @08:51PM (#3091824)
From what I remember it has an object oriented style, i.e. you don't have to parse text for a specific column you want (you call the appropriate method).

And you also get easy integration with the .NET libraries.

Re:Chocolatey - Windows Package Manager by zacgarrett on Sunday October 09, 2011 @08:58PM (#3091836)
There are also lots of libraries for powershell that make it very easy to do things. For example MS provides a great way to manage Exchange via powershell. You can even go so far as getting a GUI in powershell.

As a sysadmin I use powershell for quite a few automation and management tasks on Windows servers. It is nice to have a interface to the server that I know will always be on the server and will update by itself. There is no need to install a third party scripting language just to script simple things that are difficult to do in the standard windows command line.

Re:Chocolatey - Windows Package Manager by xpaulbettsx on Sunday October 09, 2011 @09:15PM (#3091876)
Here's an example, find all files recursively that are over 100k

    ls -r | ?{$_.Length > 100*1024}
Doing this in Bash or CMD would be annoying (certainly doable though!), especially the recursive part.
Re:Chocolatey - Windows Package Manager by gvb on Sunday October 09, 2011 @09:21PM (#3091892)

  find . -size +100k
Re:Chocolatey - Windows Package Manager by xpaulbettsx on Monday October 10, 2011 @02:20PM (#3095071)
I stand corrected :) I certainly don't want to start a "which is better" argument, just trying to give an example of something interesting in PSh
Re:Chocolatey - Windows Package Manager by burgerbrain on Sunday October 09, 2011 @10:14PM (#3091991)
'ls' has -R too, if you really want to do it like that.

Of course, that form in Unix would not be suggested, because there are other far better (readable/concise) ways of doing that. (like the 'find' one someone else just gave you).

Re:Chocolatey - Windows Package Manager by MatthewPhillips on Sunday October 09, 2011 @08:22PM (#3091757)
It has ls. Does anything else matter?