Google

2011-12-03

PowerShell 3 Community Technology Preview 2

PowerShell architect Jeffrey Snover (@jsnover) announced availability of PowerShell v3 CTP 2 today in a twitter post. I installed the 64bit version. It required a reboot.

I have not yet have a chance to look into the goodies but right out of the bat I noticed two changes.

1) While my profile was loading, I got an error message, where PowerShell 3 complained about a line in my profile which goes something like this:

write-host "$mounted_drive: could not be found"

At C:\Users\Adil\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:56 char:15
+         write-host "$mounted_drive: could not be found."
+                     ~~~~~~~~~~~~~~~
Invalid variable reference. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : InvalidVariableReferenceWithDrive


PowerShell v2 never complained about that line but I like the fact that PowerShell message is clear and suggests a way to fix it. Both of the following works

write-host "$mounted_drive : could not be found"   ## add a space
write-host "${mounted_drive}: could not be found" ## avoid ambiguity

2) PowerShell now auto-completes function names in my $profile when I hit "tab". From release notes, I see that some work went into "tabbing" and if you tab in the middle of a line, it does not delete the rest of the line anymore. This is a welcome usability change.