Windows environment variables


In Windows operating systems, environment variables are a mechanism for storing system configuration information that can be shared across the system and among applications. By correctly setting environment variables, you can easily configure system and application behavior. This article details how to set environment variables in Windows systems.

1.What are environment variables?

Environment variables are a dynamic, global set of values ​​that can be accessed by the system and applications.

These variables are stored in the operating system and are used to affect the behavior of the system and applications. For example, the system path, temporary folder path, etc. can be configured through environment variables.

2. Set system-level environment variables

The general process of configuring environment variables
Insert image description here

1)Attribute:

Search for environment variables in the Windows search bar, then click Edit system environment variables

Insert image description here

2)Open the environment variables dialog box:

In the pop-up system properties window, click the "Environment Variables" button.

Insert image description here

3)Set system-level environment variables:

In the system variable area, click the "New" button and enter the variable name and value.

Insert image description here

4)Additional amount:

In the Environment Variables dialog box, you can also edit or delete existing system-level environment variables. (The operation is the same as creating a new one)

3. Set user-level environment variables

  • Open System Properties: Similarly, search for environment variables in the Windows search bar, and then click Edit System Environment Variables

  • Set user-level environment variables: In the user variables area, click the "New" button and enter the variable name and value.

    Insert image description here

  • Edit or delete variables: In the Environment Variables dialog box, you can edit or delete existing user-level environment variables. (The operation is the same as creating a new one)

4. Use variables

After environment variables are set, the system and applications can use these variables to obtain configuration information.

For example, if you add the path to the JDK to your system's PATH environment variable,

Insert image description here

Then the command line tool can directly call Java related commands.

Insert image description here

5. Common system environment variables

Here are some common system environment variables and their uses:

  • PATH: A list of directories containing executable files where the system can find command-line tools.
  • JAVA_HOME: Specifies the installation directory for the Java Development Kit.
  • TEMP, TMP: Specifies the directory to store temporary files.

6. Precautions

  • The settings of environment variables will take effect after the user logs off or the system is restarted.
  • When user-level and system-level environment variables with the same name are set, user-level environment variables have higher priority.
  • Edit system-level environment variables carefully to avoid affecting the normal operation of the system.

Summarize

By correctly setting environment variables, we can easily configure the behavior of the system and applications and improve the customizability and flexibility of the system. This article describes the steps to set user-level and system-level environment variables in Windows systems, as well as common system environment variables.

Guess you like

Origin blog.csdn.net/yanyc0411/article/details/135007051
Recommended