Powershell string to var -
i've been struggling issue while , searched hours can't find how solve it
problem: want string, , use variable name.
example:
eval('sometext') = 'someinfo'
which out come like:
$sometext (which contains 'someinfo')
maybe little bit hard explain hope guys understand it, it's simple don't know how in powershell scripting.
you can use set-variable set variable variable name, shown below.
ps> set-variable -name ($env:computername) -value "sometext" ps> get-variable -name ($env:computername) name value ---- ----- jr-pc sometext
you can refer variable (in case):
$($env:computername)
Comments
Post a Comment