Use New-Variable
and Get-Variable
(mind available options including scopes). E.g.
for ($i=1; $i -le 5; $i++)
{
New-Variable -Name "var$i" -Value $i
Get-Variable -Name "var$i" -ValueOnly
}
More Related Contents:
- Powershell pass variable to start-job
- How to get variable name?
- C++ while loop resetting variables?
- How do you create different variable names while in a loop? [duplicate]
- What’s the difference between placing “mut” before a variable name and after the “:”?
- Using a Variable (PowerShell) inside of a command
- When should an Excel VBA variable be killed or set to Nothing?
- Why are variables “i” and “j” used for counters?
- Which variable size to use (db, dw, dd) with x86 assembly?
- HiveQL: Using query results as variables
- Why won’t Variable update?
- Assigning values to variables in a list using a loop
- setq and defvar in Lisp
- What is the difference between a member variable and a local variable?
- Is it possible to create a multi-line string variable in a Makefile
- Calling dynamic variable in PowerShell
- Determine variable names dynamically according to a string in Fortran
- Why there are two ways of declaring variables in Go, what’s the difference and which to use?
- Comparing IEEE floats and doubles for equality
- Why are variables “i” and “j” used for counters?
- How to increment variable names/Is this a bad idea [duplicate]
- Windows Batch files: what is variable expansion, and what does EnableDelayedExpansion mean?
- What is the difference between a constant and a static variable and which should I choose?
- Re-declaring variables inside loops in Java
- What is the order of local variables on the stack?
- Set fact with dynamic key name in ansible
- Loop on tables with PL/pgSQL in Postgres 9.0+
- Expanding variables in file contents
- Declaring global variable with php.ini
- Finding out reason of Pyomo model infeasibility