They are basically storage spaces for information that you want a program to know that are defined on the level of the operating system, not the program itself.
One example would be the PATH varbiable in something like Linux. It is a pointer to where you find executable programs like Python. You might want to use Python in your script, but don’t know where on the target computer python is located. You can instead call Python and the OS knows that it should look for it at any place specified in the “PATH” environmental variable.
It’s a way of configuring things within your OS and having programs being able to use it, while not having to define it in the program itself (often because you don’t have the information or you don’t want to put it into your code)
They are just key-value pairs of text.
What applications do with it is the important part, and every environemnt variable is used in differrnt places.
PATH for example is used so that if you type in a command, the computer looks in every directory that you put as value in the PATH key for a programm with that name and runs it.
Environemnt variables are available for applications to read, so you can pass information to a programm you start that way, like information on where to find something or what type of something it is.
Latest Answers