Sunday, October 07, 2012

Setting or Clearing an Environment Variable in Windows Command Prompt


The following procedures show how to set or clear an environment variable from a command prompt build window or a batch file.
To set an environment variable
  • In a command prompt build window or a batch file, type the following command:
    set <environment variable>=<value>
To clear an environment variable
  • In a command prompt build window or a batch file, type the following command:
    Note   Ensure that you do not enter a character or space after the equal sign.
    set <environment variable>=
To determine the value of an existing environment variable
  • At the command prompt, enter the following command.
    set <environment variable>
    The value for the environment variable is displayed.
    However, if you use only the first few characters in a variable name when entering the set command, this results in the display of values for all environment variables using that prefix.
To append the value of an existing environment variable
  • At the command prompt, enter the following command.
    set PATH=%PATH%;<insert your path>

No comments: