Windows configuration: What is an environment variable?

Source: Internet
Author: User

  We install a lot of software need to configure the environment variables, more configuration, you will be curious about what the environment variables mean?

  Here's the original part of the environment variables on MSDN:

Translate as follows:

  Each process has an environment block that contains environment variables and their values, and there are two types of environment variables: User environment variables (set for each user) and system environment variables (set for all users).

By default, a child process inherits the environment variables of his parent process, and the process initiated by command processor (that is, CMD) inherits the environment variables of command processor, in order to assign a different environment variable to the child process. You need to create a new environment block to pass the pointer as a parameter to the CreateProcess function. Command Processor (program) provides a set command to display his environment variable block or create a new environment variable, you can also view or modify the environment variables, by selecting the system in the Control Panel, select Advanced System settings, and click Environment Variables.

Each environment variable block contains environment variables in the following format:

Var1=value1\0

Var2=value2\0

Var3=value3\0

...

Varn=valuen\0\0

The name of an environment variable cannot contain an equal sign (=).

  Many of the things in the environment variables are useful, and the role of the path variable is that any program that opens the file will look for the folder from the current folder and the path contained in the PATH variable. In cmd, too, many of the commands in CMD are actually a small program, which can be changed to a cmd command by including the directory where the program resides. For example, we wrote a program as follows:

  

#include <stdio.h>int main (Char* argv[],int  argc) {    printf ("  123");     return 0 ;}

Finally, it was compiled and saved to the G:/myfiles, with the name Cat.exe. As long as you add G:/myfiles in path and click OK, you can write the cat,cmd in cmd to output 123. So many people say that Windows can't write its own commands, but it's wrong. (For details on how to transmit the reference is no longer detailed here).

The so-called environment variables, also variables, in cmd, according to the output method of the DOS variable, output EHCO%systemroot% will output the value of the environment variable SYSTEMROOT:

where echo represents the output, and the variable before and after is the output of the DOS command variable.

So from the translation can be understood that the system environment variables can be used by all users, and user variables can only be used for themselves.

Windows configuration: What is an environment variable?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.