One: Problem Description:
Have you ever encountered: MySQL command directly under the CMD window, prompt is not an internal or external command, is not a running program or batch file;
Have you ever met: Tomcat's Startup.bat command is directly under the cmd window, prompting not for internal or external commands, or for running programs or batch files;
Have you ever encountered: Even some help command directly under the CMD window, prompt is not an internal or external command, is not a running program or batch file, (for their own reasons accidentally deleted the environment variable under path settings)
II: Solutions;
(1) Because the environment variable path is not set, we need to add the corresponding bin directory to the path.
(2) Take MySQL as an example, assuming that the MySQL directory installed is C:\Program Files (x86) \mysql\mysql Server 5.5\bin
The first method: (Configure environment variables) If you do not have to enter MySQL directly after you open cmd, you need to configure the environment variables for MySQL, then add C:\Program Files (x86) \mysql\mysql in the environment variable Serve
The 5.5\bin is added to the path, so you can use the MySQL command directly. Tip: Because the MySQL command you're using is under C:\Program Files (x86) \mysql\mysql Server 5.5\bin so you don't know.
Can you understand it?
The second method: (Enter the response bin directory) Enter CMD after entering the CD C:\Program Files (x86) \mysql\mysql Server 5.5\bin carriage return D: Enter this time has entered into C:\Program Files
(x86) \mysql\mysql Server 5.5\bin directory, the command in this directory can be executed mysql-uroot-p enter the database password can be entered into MySQL.
Three: summary of environment variables
(1) In fact, the above two ways of the purpose is the same, are to find C:\Program Files (x86) \mysql\mysql Server 5.5\bin response mysql.ext command;
(2) environment variables in the operating system as a global variable like C + +, you type the MySQL command under any drive letter, first retrieve the global variable of this environment variable, and then retrieve the current drive letter next to contain this command.
(3) Environment variables are once and for all, so that users can apply the response commands anytime, anywhere, regardless of the location of the drive letter.
IV: Official explanations
(1) Definition: An environment variable is an object with a specific name in the operating system that contains the information that one or more applications will use. For example, the PATH environment variable in Windows and DOS operating systems, when required
When the system runs a program without telling it the full path of the program, the system should look for the path specified in path, in addition to looking for the program under the current directory. The user can run the process better by setting the environment variables.
(2) Example:
The%os% system returns the name of the operating system. Windows 2000 displays the operating system as WINDOWS_NT.
The%PATH% system specifies the search path for the executable file.
The%pathext% system returns a list of file name extensions that the operating system considers executable.
The%processor_architecture% system returns the chipset architecture of the processor. Value: X86,ia64.
The%processor_identfier% system returns the processor description.
(2) Configuration method:
In the Windows operating system, you can set the environment variables of the system through my Computer-〉 System Properties-〉 advanced system settings, environment variables, but does the environment variable set here have corresponding entries in the registry? Answer
Yes, sure. In. NET, a class is provided to get the system's environment variables and their values.
Environment variables are divided into two categories: User variables and system variables, which have corresponding entries in the registry.
Where the user variable is located: hkey_current_user\environment;
The system variable is located at: \hkey_local_machine\system\controlset001\control\session Manager\Environment.
Alternatively, you can right-click My Computer-Advanced system settings-environment variables-the PATH option in the system variable-double-hit open-adds a semicolon in the English state based on the original variable-and then enters the path name
Can. (Remember, do not delete the original system variables, as long as separated by semicolons, and then add, and finally a semicolon)
(3) Command line editing
Ways to edit environment variables in the command line
View all currently available environment variables (= System variables + user variables) set
A: View an environment variable, such as Path set path
B: Add environment variables, such as XXX=AA set XXX=AA
C: Set the value of an environment variable (such as XXX) to an empty set xxx=
D: Add a new value (such as d:\xxx) after an environment variable (such as PATH) set path=%path%;d: \xxx
(Note: The operation of the environment variable in a DOS window is only valid for the application of the current window, so the configuration method in (2) is valid)
(MySQL Tomcat)