![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Creating A Variable from the Value of Another I want to be able to create a variable from the value of another variable. For example, say that $a=example1. How could I create a variable named $example1 by using the data from $a? |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Creating A Variable from the Value of Another Use Set-Variable: Set-Variable -name $a -value 'new value' -- Kiron |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Creating A Variable from the Value of Another PS C:\Scripts> $a="hello" PS C:\Scripts> New-Variable -name "$a" -value " world" PS C:\Scripts> $hi world Shay http://scriptolog.blogspot.com > I want to be able to create a variable from the value of another > variable. For example, say that $a=example1. How could I create a > variable named $example1 by using the data from $a? > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Creating A Variable from the Value of Another sorry had a typo $a="hello" New-Variable -name "$a" -value " world" $hello world Shay http://scriptolog.blogspot.com > PS C:\Scripts> $a="hello" > PS C:\Scripts> New-Variable -name "$a" -value " world" > PS C:\Scripts> $hi > world > Shay > http://scriptolog.blogspot.com >> I want to be able to create a variable from the value of another >> variable. For example, say that $a=example1. How could I create a >> variable named $example1 by using the data from $a? >> |
My System Specs![]() |
| | #5 (permalink) |
| Guest | RE: Creating A Variable from the Value of Another Hi Luke, You can also try this technique : $a="example1" $i=10 Invoke-Expression "`$$a = $i" Best regards, Arnaud Petitjean http://www.powershell-scripting.com The french PowerShell Community "Luke" wrote: > I want to be able to create a variable from the value of another variable. > For example, say that $a=example1. How could I create a variable named > $example1 by using the data from $a? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| creating Environment variable during logon script | VB Script | |||
| $Variable Is In {1,2,3,4} | PowerShell | |||
| Creating objects with variable names in functions | PowerShell | |||
| tab and variable | PowerShell | |||
| How can I ensure that a variable is a built-in powershell variable? | PowerShell | |||