Tuesday, February 4, 2014

Creating an environment variable (Windows)

An environment variable is a variable you can have access from anywhere in the Operating System, for example in command line:
> echo %USERNAME%
elenigen

Some are already available in Windows, like USERNAME, USERPROFILE, PATH, etc.  Some can be created by the user.  You can even choose the scope of the variable, by creating it in the user or system's level.

  1. Press [Windows] + [Pause] keys
  2. Click on the "Advanced" tab
  3. Click on the "Environment Variables" button
  4. Choose the scope's level : "User variables for xyz" or "System variables"
  5. Click on the "New" button
  6. Enter variable's name and value.
  7. Click on the "OK" button
  8. Click on the "OK" button
  9. Click on the "OK" button
The new variable has been created!  The tricky part now is, all current command line windows which were already opened before the creation of this new variable, they don't have access to it, so you need to close and reopen the command line.

See also:
ss64.com/nt/syntax-variables.html

No comments:

Post a Comment