title: Get literal system variable path
body: <p>Is there any way to get the path environmental variable as a literal string instead of expanded?</p>
  
  <p>i.e.</p>
  
  <p><code>%systemroot%\System32;%systemroot%\;etc...</code></p>
  
  <p>instead of</p>
  
  <p><code>C:\Windows\System32;C:\Windows\;etc...</code></p>
  
  <p>I've tried using</p>
  
  <pre><code>Environment.GetSystemVariable("Path");
  </code></pre>
  
  <p>But that gives me the expanded directories and I don't see anything else under Environment that will get me that.</p>
  
  <p>Edit:</p>
  
  <p><code>PathUnExpandEnvStrings</code> only works if the entire path is an environmental variable.</p>
  
  <p>i.e.</p>
  
  <p><code>C:\Windows\System32;C:\Windows;etc...</code></p>
  
  <p>becomes </p>
  
  <p><code>C:\Windows\System32;%systemroot%;etc...</code></p>
  
  <p>using</p>
  
  <p><code>Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "Path", null);</code></p>
  
  <p>Still gets the values as <code>C:\Windows\System32;C:\Windows;etc...</code></p>