Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of ${} in powershell?

Tags:

powershell

I have a script where function parameters are expressed like this:

param(
   ${param1},
   ${param2},
   ${param3}
)

What does it mean? I have been unable to find documentation on this.

What's the point of writing parameters that way instead of the more usual

param(
    $param1,
    $param2,
    $param3
)

?

like image 297
Cris70 Avatar asked Feb 26 '16 08:02

Cris70


1 Answers

@MikeZ's answer is quite correct in explaining the example in the question, but as far as addressing the question title, there is actually more to say! The ${} notation actually has two uses; the second one is a hidden gem of PowerShell:

bracket notation examples

That is, you can use this bracket notation to do file I/O operations if you provide a drive-qualified path, as defined in the MSDN page Provider Paths.

(The above image comes from the Complete Guide to PowerShell Punctuation, a one-page wallchart freely available for download, attached to my recent article at Simple-Talk.com.)

like image 142
Michael Sorens Avatar answered Oct 14 '22 00:10

Michael Sorens