O'Reilly logo

Learn PowerShell Toolmaking in a Month of Lunches by Don Jones and Jeffrey Hicks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

26.4. Adding a parameter

We’ll start by declaring a –FilePath parameter. We’ll do this at the end of the existing parameter list, so we’ll show you the last original parameter by way of reference. Note that we needed to add a comma after the last original parameter, so that the parameter list would continue to include our new one. We also needed to move the closing ) from the Param block:

We used $FilePath rather than ${FilePath}; both have the same effect. The template produced by PowerShell uses only the curly brackets as a kind of better-safe-than-sorry precaution; we know that $FilePath is a legal variable name, so we don’t need the curly ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required