|
Re: Dynamic variables creation Vasily Gusev wrote:
> I also fixed the for condition - in your variant code block not called
> even once.
Yep, I also spotted this.
> Better is to use New-Variable:
> for ($i=0; $i -le 10; $i++) { New-Variable -Name "dynamicVar_$i" -value
> $i }
> And you can simplify it more:
> 0..10|%{ New-Variable "dynamicVar_$_" $_ }
Either this, or Set-Variable, if it is required that an existing
variable doesn't yeild a error condition. Right? |