clemahieu
clemahieu

Reputation: 1429

Powershell, interactively invoking a static method

I'm sitting at a PowerShell command prompt and following http://technet.microsoft.com/en-us/library/dd347632.aspx

PS C:\> [System.Math]::Sqrt (9)
Unexpected token '(' in expression or statement.
At line:1 char:22
+ [System.Math]::Sqrt ( <<<< 9)
  + CategoryInfo          : PArserError: ((:String) [], ParentContainsErrorRecordException
  + FullyQualifiedErrorId : UnexpectedToken

Am I being tricked or did the tutorial give me something that has a syntax error?

How do I do a basic thing like invoke a static method?

Upvotes: 3

Views: 304

Answers (1)

manojlds
manojlds

Reputation: 301297

Don't have the space after Sqrt:

[System.Math]::Sqrt(9)

Upvotes: 5

Related Questions