Environment variables

In the DOS environment memory is reserved for user defined variables. Enviroment variables can be used for different things: 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

Updated: 2 July 2007

Leave a Reply

Your email address will not be published. Required fields are marked *