Developer

Bash + cmd = Powershell?

<b>Commentary</b>Microsoft's PowerShell looks to be a revolution that envelopes the advantages of both bash and cmd as well as adding a powerful new dimension to scripting in general.

Commentary: Microsoft's PowerShell is a solid step forward in script-language design. The power of the system comes from the background use of objects, as opposed to plain text.

Aesthetically, PowerShell doesn't look too different from most existing shell scripting clients. In fact, on a superficial level you could probably be fooled into thinking that it is exactly the same as either bash or cmd. PowerShell, however has a very powerful underlying structure that ties in neatly with the registry, the .NET Framework and (more obviously) the file system.

PowerShell is designed for the comfort of both Unix and Windows system operators. There are predefined aliases for all of the common commands that usually plague developers who bounce from one platform to another. A directory listing can be achieved by using either dir or ls and the result is identical. Similar aliasing is used for directory alterations and other common tasks. However, there is one fundamental difference. The text displayed on screen is a result of a collection of objects using their ToString functions, as opposed to a simple text dump.

Every command in PowerShell returns a collection of objects. These objects can be manipulated in the exact same way as if you were using an object-oriented language. The ls/dir command creates a collection of file objects which can have any .NET function performed upon them from within the shell. The default action being their ToString method (for display purposes), but there are no restrictions to what you can do with the collection.

PowerShell allows the output of the objects to be formatted in many common ways. If the user does not specify a format for the output, PowerShell automatically selects the one it thinks is the most suitable. Common commands can be written and stored on the fly and will last until the session is terminated. They can also be permanently written into the PowerShell's setup files.

As previously mentioned, PowerShell is not restricted to file system manipulation. There is native support for registry editing; if fact, the Registry is treated as if it was just another directory. As a result, a lot more can be accomplished by the one window without its behaviour being unpredictable or awkward.

PowerShell was originally slated for release with Vista, but its release has now been postponed and will be released online. A beta version is available here.

Editor's Picks

Free Newsletters, In your Inbox