title: How do you update an environment variable using Ruby and Chef?
body: <p>I know how to set the variables for both user and machine.
  The problem arises when I try to add to the PATH. Currently my code will overwrite what is in the PATH.</p>
  
  <pre><code>execute 'set java_home2' do
  command "setx -m PATH2 \"D:\\Home"
  *only_if {"PATH2" == " "}*
  end
  </code></pre>
  
  <p>This currently ensures that the PATH will only run if there is no PATH. When the only_if is removed the problem of overwriting arises.</p>
  
  <p>EDIT:
  I am now able to modify the system variable but cannot work out how to do the same with the user variables</p>
  
  <pre><code>env 'path addition' do
  key_name "PATH"
  value (ENV["PATH"] + ";D:\\Home\\Apps\\variable")
  :modify
  end
  </code></pre>