Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure update environment variables under windows does not need to restart the system to take effect quickly.

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to configure windows to update environment variables do not need to restart the system to take effect quickly", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to configure windows update environment variables do not need to restart the system to take effect quickly" bar!

What are environmental variables?

The result of the encyclopedia is that it generally refers to some parameters used in the operating system to specify the operating system environment, such as temporary folder location and system folder location. Although very official, but I think it is very popular, there is no need to explain.

How to set environment variables

According to the above concepts, we know that environment variables are some variable parameters of the operating system environment, since they are variables, they can certainly be changed, so according to my picture to set the environment variables of the window7 system, other systems can refer to the specific system operation methods. As shown in the figure:

Set the role of environment variables

As a developer, it is generally mainly because we have installed a new software or feature, and we need to use the command line to test whether the installation is successful. For example, java-version shows the jdk version of java and other information.

Generally, the following error occurs when the installation software executes this command:

This prompt message is very clear, that is, the mvn program does not exist, but we confirm that the software has been installed, so why is this still the case? it is mainly because when the command is executed in the dos window, it will find the corresponding command according to the path in our environment variables, but in general, path sets the core directory of the system. So our newly installed software directory is not in the system's environment variables, so there will be dos can not find the corresponding program under path, so there will be the above error.

There are two ways to solve this problem. 1 is cd (of course, you can also drag and drop it into dos) to the appropriate installation directory, find the program, and execute it as shown in the figure:

In that case, we need cd to go to this directory every time. I don't think most people like it.

Another way is like the command that comes with the system, such as the ping command, how to do that, that is to set the environment variable, so we can set the installation directory of the software to the system's path variable.

But there is a problem with this, that is, we need to restart our system before the environment variables can take effect, which is sometimes unacceptable to us.

Do not restart the system to achieve the effectiveness of environment variables

To open the dos window using windos+r, perform the following:

We can see that the path we set has taken effect, and the default properties of the system are gone. Is it very depressing? don't worry, the relationship temporarily explained as the system cache will be described in more detail in the future.

What we need at this point is to reopen a dos interface and execute java-verion again, and this time the display is normal.

We echo% path% found that the environment variable is in effect.

The goal has been achieved, but what is the reason?

Generally speaking, the environment variable of the system is the configuration information of the system. For example, in our usual development process, our configuration files are usually loaded at once and then cached. If you want to modify the configuration information, you usually need to restart the application, and so is the operating system. Then why is the path output from our dos window the value we set just now? the main reason is that the system provides a command set to set environment variables, and opens a dos window to set it. Then the current environment variable of the dos program will become just set. Because the current environment variable is a copy of the global variable, this configuration information has changed relative to the overall configuration of the system, and the internal mechanism of the operating system will refresh the current configuration file, so when we open the dos window again and run it, we will find that our path settings are in effect. The general reason is that in popular terms, some concepts may not be very professional or accurate. I will update and load them separately in the future.

Thank you for your reading, the above is the content of "how to configure update environment variables under windows does not need to restart the system to take effect quickly". After the study of this article, I believe you have a deeper understanding of how to configure update environment variables under windows without the need to restart the system to take effect quickly, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report