Param basics

by BustedFlush at 2013-04-16 07:13:30

I read Don’s post on param here: … 54301.aspx
but I’m still very confused. I tried this; it doesn’t work. Why not?


Write-host $foo, $bar

PS C:\users\BustedFlush> .\foobar -foo big -bar fish

At C:\users\BustedFlush\foobar.ps1:2 char:5
+ $foo
+ ~
Missing ‘)’ in function parameter list.
At C:\users\BustedFlush\foobar.ps1:4 char:1
+ )
+ ~
Unexpected token ‘)’ in expression or statement.
+ CategoryInfo : ParserError: (:slight_smile: [], ParseException
+ FullyQualifiedErrorId : MissingEndParenthesisInFunctionParameterList
by JeffH at 2013-04-16 07:20:11
Is that the complete script?
by BustedFlush at 2013-04-16 07:23:09
by JeffH at 2013-04-16 07:29:08
I had no error. PowerShell seems to think you don’t have the closing ). You might open your file in Notepad and look for any weird control characters. Or delete the ) and add it back.
by BustedFlush at 2013-04-16 07:36:37
Well, that’s weird. It looked exactly the same in notepad, but when I pasted it back in it worked fine.

OK, cool. Thanks!