"May I please test Longhorn Beta 1?"

You’ve got to love the enthusiasm surrounding Longhorn.  In the words of one of its beta coordinators:

“This is the first time in 10+ years involvement with customer beta programs that I’ve received an unsolicited bribe to get on the program– two pounds of inscribed chocolate showed up at my office via Fedex today.”

The chocolate was shared far and wide – I’ll bet it satisfied at least 1 or 2 mid-afternoon sugar cravings :)

Regular Expressions in Monad

SteveX has a Monad forum on his site, and one of the first topics posted (by Ayende) was an example script on using regular expressions in Monad.

This is helpful example of how well Monad integrates with the .Net framework.  You can call out to [System.Text.RegularExpressions.Regex], and port your C# regular expression almost effortlessly.

But wait, it only gets better.

Regular Expressions are a glorious beast of burden in scripting languages, as you might have noticed if you’ve read much Perl.  Because of that, we’ve given them first-class language support via the “-match” expression.

Param statement, and new-object

Vivek recently posted a helpful script to get the contents of a web page.

As is common with .Net and Monad, there is more than one way to do it. In addition, there are also two Monad facilities we can take advantage of to make the script more readable: new-object, and the param statement.

First of all, the easy one. The new-object cmdlet creates a new object. In the current drop, it only creates .Net objects, but COM support is coming soon. This cmdlet replaces the calls to [Activator]::CreateInstance in Vivek’s script.

Monad Hosting Part II -- Stop acting like cmd.exe!

Travis recently posted a good comment:

… I would *love* to be able to configure Monad’s tab completion behavior! …

So would we.

Tab completion is just one of the many things that would be great to change about the default Monad console host.  Other things that drive us crazy are the lack of standard CUA bindings (ie: Copy, Paste, keyboard-based selection,) and full Unicode support, to name a few.  It’s comes down to a matter of priority.

A History Browsing Prompt

Now that we’ve come up to speed with the new beta, it’s time to continue our journey into customizing the prompt. It’s been almost a month since I promised it, and a lot of you are already doing great things with your custom profile.

For reference sake, this is our current prompt function, as defined in profile-custom.msh:

function prompt  
{  
   $currentDirectory = Get-Location  
   "MSH $currentDirectory >"  
}

That prompt looks like:

MSH C:\Documents and Settings\Lee >

Ideally, we want it to act more like this:

** WARNING ** MSH may make you _too_ efficient

Warning: New research suggests that using Monad (MSH) may make you too efficient.  In a recent study, animals that were provided chronic access to MSH worked harder, and ate less.

It’s a fun shell, and a fun language – but please, everything in moderation.

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Working with the new Monad beta -- getting settled in

As I mentioned earlier, we posted a new MSH beta to BetaPlace. It’s a lot more polished than the one we posted 9 months ago, so I’ll be working with that version from now on. The articles so far haven’t delved very deeply into code just yet (how fortunate!) so there aren’t many breaking changes we need to comply with. However, there have been few – so let’s go over them.

Jeffrey Snover's Monad TechEd Presentation ... now by Webcast

If you were one of the many that missed Jeffrey’s standing-room-only presentations at TechEd, the kind folks at TechNet feel your pain. They’ve decided to host a series of “Best of TechEd” webcasts, and our two presentations are among them. If you want to learn more about the capabilities of Monad, be sure to check these out.

**Session 1: Next Generation Command Line Scripting with Monad (Part 1 of 2) (Level 300)
**This session provides an architectural overview of Monad, and begins to introduce many of its powerful features.
http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032277850&EventCategory=4&culture=en-US&CountryCode=US

Monad, RSS, XML, and other cool tricks

Adam has been fleshing out a great use of Monad – by creating a mini command-line RSS reader!  It’s touched on registry modification, XML parsing, internet access, and more.

Check it out, if any of those buzz words interest you :)  All we need to do is throw AJAX and Web 2.0 into the mix, and we’ll have a home-run IPO!

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Creating SQL's "join"-like functionality in MSH

An interesting thread came up on our BetaPlace newsgroup today, asking if MSH supports a SQL-like join command.  After all, we do already support the select-object cmdlet, which allows you to pick individual properties for display.  Given our display model (that often looks and feels like a SQL grid output,) this is a totally great question.  It’s a feature I’ve always wanted in a shell, too.

We don’t support the feature natively, but the MSH language sure does.