Environment variables
In the DOS environment memory is reserved for user defined variables. Enviroment variables can be used for different things:
- Batch files can use them for temporary storing values during executions.
- When creating environment variables in a batch file, then one must remember to clear them again before exiting, or else they continue to live on and consume memory after the batch file have executed.
- Global variables specified in Autoexec.bat, which affects the behavior of the DOS environment and programs executed within the environment:
To list all environment variables in memory:
SET more
To show the value of a single environment variable:
SET CLASSPATH
ECHO %CLASSPATH%
To change the value or create a single environment variable:
SET CLASSPATH=.;C:\JDK
To append to an existing environment variable:
SET CLASSPATH=%CLASSPATH%;C:\MY_JAVA
To clear or delete a single environment variable:
SET CLASSPATH=
Note when using SET from the command prompt then the environment variable will only live temporarily and will be forgotten when the command environment closes. To make a permanent environment variable move the SET of the variable to the AUTOEXEC.BAT.
Related Configure how much memory to allocate for environment variables
Related Batch file input parameters are accessed like environment variables
More Info MS KB36605
More Info MS KB41246
More Info MS KB66292
More Info MS KB121170
More Info MS KB153163