SoSleepy

Troy Bowman

Quickly Create An Array of Strings Without Quoting Each String

When there is a list of words that need to be quickly converted to an array of strings, use this quick method.

function ql {$args}
function ql {$args}
$StringArray = ql apple orange kiwi peach
$StringArray
($StringArray).gettype()

The ql function will quickly create an array of strings without needing to use any quotes. Very handy!

Example Output

This is such a great tip from the book: Windows PowerShell in Action, Third Edition by Bruce Payette and Richard Siddaway.

It is not out of date at all because most of the concepts are core to PowerShell and helpful for any new version of PowerShell released.

https://www.manning.com/books/windows-powershell-in-action-third-edition

,

Leave a Reply

Your email address will not be published. Required fields are marked *