Windows and MS-DOS Environment variables

Environment variables are a mechanism of the operating system to store information. This information is used by both the operating system and other programs.

An example is the PATH variable. When we ask the operating system to run a program, it looks for it in the directories listed in this variable.

Another example is JAVA_HOME. Many programs that use Java, look for the JAVA_HOME variable, to know where is Java installed. Eclipse development tool is one of them.

How to access and modify MS-DOS environment variables.

It is often necessary to access or modify environment variables from batch files or lot processing. In Windows, these files usually have the extension "bat".

You may also access the environment variables from the MS-DOS console. Below, we can see what MS-DOS commands can be used for this:

Environment variables in Windows

The modifications you make to environment variables in the console, only affect the console session and will be lost when the console is closed. If we want changes to persist when we turn off the computer, we will have to make them in the Windows environment.


Find "Control Panel \ System" from the start menu.

We can also reach the same point by clicking the right mouse button on the "My Computer-properties" button, from the file browser, or from the start menu.


Click on advanced system settings:


Click on the environment variables button, on the Advanced tag.


Choose the variable we want to delete or edit or create a new one.