Assigning a number to a Powershell variable

Hi, I've got an int variable that I'm trying to assign a certain number to  [int]number=200  But I'm getting:    

At line:1 char:6
+ [int]liczba=200
+      ~~~~~~~~~~
Unexpected token 'number=200' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Add comment

Choose authorization option

Log in

If you have an account on CentrumXP this option will be best for you.

Log in
Join community

Our registered users have extra privileges like adding questions, commenting, and voting.


Answer: 1

seems to be a minor problem. Place te $ sign before your variable and will work just fine

3 years ago
3 years ago
Correct answer
  • Silverobama 7/11/2017, 2:17:21 PM

    Ok, thx, it works now

Add comment