Creating a dynamically-named variable in PowerShell -


i'd create variable offsetx, x number. right now, use:

new-variable -name offset$i 

where $i integer. however, want offset($i-1). how change syntax of above statement accomplish this?

my latest attempt was:

new-variable -name offset+"[int]$i-1" 

which didn't result in error being thrown, still doesn't accomplish goal.

put subtraction part inside $(...), known subexpression operator.

below demonstration:

ps > $i = 2  ps > new-variable -name offset$($i - 1) -value value ps > $offset1 value ps >  

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -