title: The opposite of Environment.ExpandEnvironmentVariables
body: <p>Is there a method that does the opposite of the <a href="http://msdn.microsoft.com/en-us/library/system.environment.expandenvironmentvariables.aspx" rel="nofollow">Environment.ExpandEnvironmentVariables</a> method.</p>
  
  <p>What I mean, is that upon given a path, the method returns its EnvironmentValue counterpart.</p>
  
  <p>For example:</p>
  
  <blockquote>
    <p>C:\users\user\AppData\Local\foo\bar</p>
  </blockquote>
  
  <p>should be turned into:</p>
  
  <blockquote>
    <p>%LOCALAPPDATA%\foo\bar</p>
  </blockquote>
  
  <p>(In order for configuration files to be portable.)</p>