powershell use variable in command code example
Example 1: set variable in powershell
Set-Variable -Name "desc" -Value "A description"
Get-Variable -Name "desc"
Name Value
---- -----
desc A description
Example 2: powershell command line variables
write-host "There are a total of $($args.count) arguments"
for ( $i = 0; $i -lt $args.count; $i++ ) {
write-host "Argument $i is $($args[$i])"
}