title: Difference between Dynamic Environment Variables and Normal Environment Variables in CMD
body: <p>I was reading an article on <a href="https://ss64.com/nt/syntax-variables.html" rel="nofollow noreferrer">ss64</a> about Environment variables in Command Prompt.</p>
  
  <p>Later in the article there exists a <em>table</em> which states environment variables found commonly in Command Prompt. Some of the variables listed there are termed as <strong>Volatile</strong> (Read Only). A sentence found in the article states:-</p>
  
  <blockquote>
    <p>Dynamic environment variables are read-only and are computed each time the variable is expanded. When all variables are listed with SET, these will not appear in the list. Do not attempt to directly SET a dynamic variable.</p>
  </blockquote>
  
  <p>I understood the later two statements. But i can't understand the first one.</p>
  
  <p><strong><em>Doubts:-</em></strong></p>
  
  <ul>
  <li><p><code>%userprofile%</code> is an <em>non-volatile</em> variable, which resolves to <code>%SystemDrive%\Users\{username}</code>, and <code>%homepath%</code> is a <em>volatile</em> variable which resolves to <code>Users\{Username}</code>. Both commands are quite similar (except for the <code>systemdrive</code>). Then why is one volatile and the other one non-volatile?</p></li>
  <li><p>What is the criteria for a variable to be dynamic? what makes <code>%appdata%</code> (just an ex.) an non volatile variable?</p></li>
  <li><p>Dynamic Variables are computed each time the variable is expanded, this makes sense for variables like <code>%CD% %DATE% %TIME% %RANDOM%</code> etc. as they would lose their functionality if they would be <em>non-volatile</em>. But how would it effect <code>%homepath%</code>?</p></li>
  <li><p>Some <em>non-volatile</em> variables have sort-of dynamic components in them. Ex. <code>%userprofile%</code> has <code>%SystemDrive%</code> and <code>{username}</code> in it's path. Then how are those variables not dynamic?</p></li>
  </ul>