Pointer or reference variables
<p>I want to use indirect reference variable. 
I am setting this at Command Prompt </p>

<pre class="lang-batch prettyprint-override"><code>SET RiskScheduler=true
</code></pre>

<p>My code is like this </p>

<pre class="lang-bsh prettyprint-override"><code>Write-Host "$Env:RiskScheduler"  # prints true 
</code></pre>

<p>I want to achieve the same should be printed with code like this </p>

<pre class="lang-bsh prettyprint-override"><code>$name='RiskScheduler'  
Write-host $name                # prints RiskScheduler
Write-Host $Env:$name           # gives error
</code></pre>

<p>The error I am getting is </p>

<pre>
Cannot process argument because the value of argument "path" is invalid.
Change the value of the "path" argument and run the operation again.
At D:\tmp\buildtools\udclient.6.2\ud_clean.PS1:37 char:17
+ Write-Host $Env: &lt;&lt;&lt;&lt; `$name`
    + CategoryInfo          : InvalidArgument: (:) [], PSArgumentException
    + FullyQualifiedErrorId : Argument
</pre>

<p>I am looking for something that shall first evaluate <code>$name</code> and then evaluate <code>$Env:(value of $name)</code>.</p>

<p>Can someone please suggest, what the correct syntax is?</p>