About
The setx command will set an environment variable for the scope of the terminal. Once the terminal is closed, the value is no more available.
Example
For the example below to work, you need to have the permission to set a variable. Run your terminal in Administrator mode then.
The following
setx HOME_PERFTOOL D:\perftool
SUCCESS: Specified value was saved.
will create and set the environment variable HOME_PERFTOOL to the value D:\perftool
Syntax
The setx command Creates or modifies environment variables in the user or system environment. Can set variables based on arguments, regkeys or file input.
More:
setx /?
Support
The data being saved is truncated to 1024 characters
WARNING: The data being saved is truncated to 1024 characters.
SUCCESS: Specified value was saved.
Just use the Windows - Environment Variable to change it otherwise you need to send WM_SETTINGCHANGE (but it's not possible in DOS)