title: Why can't I retrieve custom environment variable?
body: <p>I created a user environment variable <code>testPurpose</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/nG1aY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nG1aY.png" alt="test"></a></p>
  
  <p>My script either doesn't display it if I call it like this:</p>
  
  <pre><code>$env:testPurpose
  </code></pre>
  
  <p>or if I try this way</p>
  
  <pre><code>$x = "testPurpose"
  (get-item env:$x).Value
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>get-item : Cannot find path 'Env:\testPurpose' because it does not exist.</p>
  </blockquote>
  
  <p>Using <code>gci env:* | sort-object name</code>, I can clearly see it has been created for sure</p>
  
  <p><a href="https://i.stack.imgur.com/xItnV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xItnV.png" alt="display envs"></a></p>
  
  <p>So why can't I retrieve it? If I try this:</p>
  
  <pre><code>$env:ProgramData
  </code></pre>
  
  <p>I get back program data location printed just fine! </p>
  
  <p>So I am positive it's not a command issue</p>