Complete Guide to PowerShell Punctuation

Quick as you can, can you explain what each of these different parentheses-, brace-, and bracket-laden expressions does?

${save-items}
${C:tmp.txt}
$($x=1;$y=2;$x;$y)
(1,2,3 -join '*')
(8 + 4)/2
$hashTable.ContainsKey($x)
@(1)
@{abc='hello'}
{param($color="red"); "color=$color"}
$hash['blue']
[Regex]::Escape($x)
[int]"5.2"

When you're reading someone else's PowerShell code, you will come across many of these constructs, and more. And you know how challenging it can be to search for punctuation on the web (symbolhound.com not withstanding) !

That is why I put together a reference chart containing all of PowerShell's symbology on one page. making it much easier when you need to look up a PowerShell symbol as you read code--or to browse for the right construct when you are writing code.

PowerShell Punctuation wall chart

Download the Complete Guide to PowerShell Punctuation wallchart from here.

About the Author

Michael Sorens

Software designer/architect, application/website developer (including several open source projects), author (over 100 articles published and over 200 answers on StackOverflow), educator--see full brand page at http://cleancode.sourceforge.net/wwwdoc/about.html.

2 Comments