title: M2_HOME is set to an invalid directory even when it points to maven installation home
body: <p>I have set my M2_HOME to</p>
  
  <pre><code>C:\Users\username\Documents\apache-maven-3.5.0
  </code></pre>
  
  <p>Contents of above directory</p>
  
  <pre><code>09/21/2017  05:13 PM    &lt;DIR&gt;          .
  09/21/2017  05:13 PM    &lt;DIR&gt;          ..
  09/21/2017  05:13 PM    &lt;DIR&gt;          bin
  09/21/2017  05:13 PM    &lt;DIR&gt;          boot
  09/21/2017  05:13 PM    &lt;DIR&gt;          conf
  09/21/2017  05:13 PM    &lt;DIR&gt;          lib
  04/03/2017  08:41 PM            20,934 LICENSE
  04/03/2017  08:40 PM               182 NOTICE
  04/03/2017  08:36 PM             2,544 README.txt
                 3 File(s)         23,660 bytes
                 6 Dir(s)  348,568,027,136 bytes free
  </code></pre>
  
  <p>However when I run mvn --version in cmd, I get the following error</p>
  
  <pre><code>ERROR: M2_HOME is set to an invalid directory.
  M2_HOME = "C:\Users\abhish\Documents\apache-maven-3.5.0"
  Please set the M2_HOME variable in your environment to match the
  location of the Maven installation
  </code></pre>
  
  <p>I checked a similar <a href="https://stackoverflow.com/questions/33417447/error-m2-home-is-set-to-an-invalid-directory">post</a> on SO. However that didnt help, hence posting this question.</p>
  
  <p>I need this solved to solve <a href="https://stackoverflow.com/questions/46364181/eclipse-is-not-downloading-plugin-from-central-maven-repo?noredirect=1#comment79688209_46364181">this</a> problem.</p>