title: C:/Program is not recognized as an internal or external command
body: <p>I have JAVA_HOME variable in System variables and is set to</p>
  
  <pre><code>C:\Program Files\Java\jdk1.8.0_60
  </code></pre>
  
  <p>I get an error when I try to use command <code>%JAVA_HOME%</code> </p>
  
  <blockquote>
    <p>C:/Program is not recognized as an internal or external command.</p>
  </blockquote>
  
  <p>I understand it is because of space in the path after Program, </p>
  
  <p>I have also tried using quotes across the path but it did not resolve the issue.</p>
  
  <p>i.e</p>
  
  <pre><code>"C:\Program Files\Java\jdk1.8.0_60"
  </code></pre>
  
  <p>but no help.</p>
  
  <p>Edit: I tried removing ones with Program Files at all.</p>
  
  <p>Now my System path variable looks like this:</p>
  
  <pre><code>%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
  </code></pre>
  
  <p>Environment path variable looks like this:</p>
  
  <pre><code> C:\Users\dev4\AppData\Roaming\npm; C:\mongodb\bin;
  </code></pre>
  
  <p>So, I do not really see any of these with space or program files in path
  and yet when I try </p>
  
  <p>%Path% </p>
  
  <p>it gives the same error.</p>
  
  <p>EDIT 2:</p>
  
  <p>cd %PATH% gives The file name or extension is too long.</p>
  
  <p>however cd %JAVA_HOME% works</p>
  
  <p>Edit 3: Now, the PATH variable has location fo JDK bin but none of my java commands are recognized</p>