Run PowerShell as a shell within Emacs
blogs.msdn.com
blogs.msdn.com
If it's cross-platform scripting ability you're after, then why not focus efforts on developing OS-layer abstractions that various scripting languages which are already cross-platform (perl, python, ruby, etc) can use? Given that, what does Powershell offer that these don't?
I can't speak for the author of Pash, but for me (and I like bash) is that unlike in the typical Unix shells, you don't pipe and work with text, you do it with fully fledged objects.
So needless to say (if you can get over the somewhat icky syntax) you can do some very neat and powerful stuff with a minimum of effort.
Want to kill all processes starting with z? Easy.
Get-Process | where {$_.Name -like "x*" } | kill
Want to kill the biggest memory offender on the system? Also easy. Get-Process | Sort-Object workingset -descending | Select-Object -First 1 | kill
Want to list all running services? Also easy, just filter: Get-Service | where {$_.Status -eq "Running" }
Want it exported to for instance csv? Sure. Get-Service | where {$_.Status -eq "Running" } | Export-Csv services.csv
Like I said. The syntax leaves something to be desired, but the concept of piping objects is pretty powerful in a shell, and I like how you can add providers, so you can use this with the filesystem, registry, database-servers, whatever and just navigate it naturally and use the same syntax and commands for most processing.It may not be for everyone, but it certainly has its place.
I understand if one would want it under Windows, but it's not a step in the right direction for anyone else.
How does the Export-Csv know what information you want to be exported?
mycommand2 `mycommand |awk '{print $2}'`
vs mycommand|mycommand2 $_.myproperty
Which is more readable? Which survives mycommand being enhanced with another column of output? It doesn't make sense to use PowerShell on Unix because none of the existing commands emit C structs, there's no way to get the output of ps as struct after the pipe.To modify my example to only export service name and descriptive name:
Get-Service | where {$_.Status -eq "Running" } | select Name, DisplayName | Export-Csv services.csvI'm kinda liking Rush, a object-orientated shell written in Ruby. The syntax is a lot nicer, assuming you're into Ruby:
processes.select(:cmdline => /^z/).kill
It also works a lot better with remote machines.Powershell's main weaknesses, in my opinion at least, is that it doesn't handle remoting very well, and that it requires the user to learn a new syntax in order to use it. I really like learning new languages, but I don't see myself needing Powershell anywhere near often enough to warrant remembering its syntax.