Preview 5 of Microsoft's PowerShell 7 dropped last night, which means that final release is lumbering ever closer.
Though there is only one more preview left ahead of a Release Candidate in time for Christmas (and the final release of .NET Core 3.1), the gang has continued to load up the cross-platform command-line shell with new features.
Steve Lee, the principal software engineer manager behind the project, listed some of the more notable tweaks, starting with Pipeline Chain Operators.
While PowerShell has had
if to perform conditional execution, it is a bit clunky compared to other shells. To that end,
|| have been added as pipeline operators to chain functions or cmdlets together based on the success or failure of the left-hand command.
else statements have taken a further bashing with the new
?? coalescing operator, which will return the value of a statement if it's not null, or something else if it is.
Other improvements include tab completion for variable assignment and improvements in
Format-Hex formatting. Hidden away in the notes is also the return of
Get-HotFix, which will please Windows-using administrators. The cmdlet queries the system to get a list of installed patches and had been dropped due to PowerShell Core 6's dependence on .NET Core 2.x.
However, with the advent of .NET Core 3.0 and the return of the
System.Management namespace, PowerShell 7 users (on Windows) can once more gaze in awe at the sheer number of patches on their systems.
Re-enabling that cmdlet is handy as the gang continues to head towards making the original Windows-only PowerShell redundant.
For many, the chain operators and
$null handling improvements this time around will be worth the price of admission alone, although the additional tools to deal with the swathes of red text vomited at users when things go wrong are also most welcome.
Lee teased that November's final preview would have a "few more features" before things are locked down for the Release Candidate in December and General Availability in January. ®