Home > Mobile >  Difference between using New-Variable and the assignment operator "=" to create variables
Difference between using New-Variable and the assignment operator "=" to create variables

Time:09-27

Newbie question...
Is there a difference between using New-Variable to using the assignment operator "=" to create variables in PowerShell scripts?

e.g.

$var1 = "lalalala"

vs

New-Variable var1 "lalalala"

CodePudding user response:

New-Variable have additional parameters like description, constant which can be useful in some cases.

  • Related