Monthly Archives: February 2015

Some new syntax in Powershell

Now sure when this happened, but looks like we have new syntax for defining arrays. It looks like below:


$a = $(1,2,3)

What is this, what is the result here. Lets try some new features of WMF 5 February preview. Just do couple of things

  1. Download and install the preview
  2. Start the PowerShell with admin credentials
  3. Run the following command. This going to download the module from PowerShell repository from here
    Install-Module -Name PowerShellCookbook
    

    2015-02-27 20_43_18-Administrator_ Windows PowerShell

  4. At this point we have installed the PowerShellCookbook module and we are interested in Show-Object cmdlet from it.
  5. We can just pipe pass the variable to it and see the below megathing!
    Show-Object $a
    

    Array

Really cool. Here we see it is an array

Advertisements