title: I wish to set MAVEN_HOME in the "System Variables" using cmd -> run as administrator
body: <p>I am trying to set the MAVEN_HOME environment variable using the setx command but in order to set it as a "System variable" and not the "User variable". In order to do this, I have to use -m with setx. Also, I wish to set MAVEN_HOME path as the current directory path in which the batch file is being run. I do this by</p>
  
  <pre><code>setx -m MAVEN_HOME "%cd%\apache-maven-3.6.1"
  </code></pre>
  
  <p>If I dont use -m then it sets the Env_variable as a user variable and if I use -m and run it as administrator then it does not pick the current directory path which is "C:\Users\nitin\Desktop\KristomInstall\apache-maven-3.6.1" using %cd%. Instead it picks </p>
  
  <pre><code>C:\WINDOWS\System32\ 
  </code></pre>
  
  <p>as the path using %cd%.</p>
  
  <p>What I need is to use -m and run it as administrator along with a way to get the current location of the batch file I am running(as I was trying to do it using %cd%) </p>
  
  <pre><code>setx -m MAVEN_HOME "%cd%\apache-maven-3.6.1"
  </code></pre>
  
  <p>so I can distribute this batch file to other systems without manually adding the path to set MAVEN_HOME.</p>