After Maven is installed, the command line executes the prompt `mvn'-v`: "mvn' is not an internal or external command, nor is it a runnable program or batch file."

similar problems

  1. extract the zip package downloaded from the official website to the corresponding directory
  2. the environment variable is configured

MAVEN_HOME = C:\ Program Files\ Apache Software Foundation\ apache-maven-3.5.3
Path add ;% MAVEN_HOME%\ bin

Path also added % SystemRoot%\ system32;%SystemRoot%;%SystemRoot%\ System32\ Wbem; still has no effect.

  1. make sure you have administrator privileges, and the same is true for changing to the directory on disk D.
  2. is executed directly in the directory, and it is valid to change it to .\ mvn-v as prompted.
PS C:\Program Files\Apache Software Foundation\apache-maven-3.5.3\bin> mvn -v
mvn : "mvn"  cmdlet

 :1 : 1
+ mvn -v
+ ~~~
    + CategoryInfo          : ObjectNotFound: (mvn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]:  mvnWindows PowerShell  ".\mvn"  "get-help about_Command_Precedence"
PS C:\Program Files\Apache Software Foundation\apache-maven-3.5.3\bin> .\mvn -v
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.5.3\bin\..
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre1.8.0_144
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

refer to some online solutions, all of which are ineffective.

but it works in IntelliJ!

Mar.03,2021

Path + =;% MAVEN_HOME%bin what syntax is this?

it should be written this way

PATH = %MAVEN_HOME%\bin\;%PATH%

the unzipped package of maven should be put on disk c, otherwise this

will be prompted.
Menu