Windows environment variables basics

Perm url with updates: http://xahlee.org/mswin/env_var.html

Windows Environment Variables

Xah Lee, 2009-10-03, 2010-06-18

This document is a basic tutorial about Windows's Environment Variables. The code here is tested on Windows Vista.

Environment variables are system-wide global variables. They are somewhat like config parameters, and is used by processes. For example, apps need to know the path of your Windows kernal, path to cmd.exe, path of your home dir, paths to search for shell programs, etc.

To view and set your env var, go to Control Panel, then click the “System” icon, then click the “Advanced system settings” link, then “Advanced” tab, Environment Variables button.

Windows env var

The Windows System control panel for editing env vars.

You can launch the app directly in cmd.exe or PowerShell by typing the following (Windows Vista):


Env var names are not case sensitive. So, “PATH”, “Path”, “path” are treated the same.

Sample Values Of Env Var

Here's example of env var values as it exists on my system.

Name                           Value
----                           -----
ALLUSERSPROFILE                C:\ProgramData
APPDATA                        C:\Users\xah\AppData\Roaming
CLASSPATH                      .;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
CommonProgramFiles             C:\Program Files\Common Files
CommonProgramFiles(x86)        C:\Program Files (x86)\Common Files
COMPUTERNAME                   XAH-PC
ComSpec                        C:\Windows\system32\cmd.exe
DFSTRACINGON                   FALSE
FP_NO_HOST_CHECK               NO
HOME                           c:/Users/xah
HOMEDRIVE                      C:
HOMEPATH                       \Users\xah
LOCALAPPDATA                   C:\Users\xah\AppData\Local
LOGONSERVER                    \\XAH-PC
OnlineServices                 Online Services
OS                             Windows_NT
Path                           C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x8...
PATHEXT                        .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PSC1
PCBRAND                        Pavilion
Platform                       HPD
PROCESSOR_IDENTIFIER           AMD64 Family 16 Model 2 Stepping 3, AuthenticAMD
PROCESSOR_LEVEL                16
PROCESSOR_REVISION             0203
ProgramData                    C:\ProgramData
ProgramFiles                   C:\Program Files
ProgramFiles(x86)              C:\Program Files (x86)
PSMODULEPATH                   C:\Users\xah\Documents\WindowsPowerShell\Modules;C:\Windows\system32\Windows...
PUBLIC                         C:\Users\Public
PYTHONDOCS                     C:\Users\xah\na_xruti\python-2.6.2-docs-html
QTJAVA                         C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
SESSIONNAME                    Console
SystemDrive                    C:
SystemRoot                     C:\Windows
TEMP                           C:\Users\xah\AppData\Local\Temp
TMP                            C:\Users\xah\AppData\Local\Temp
TRACE_FORMAT_SEARCH_PATH       \\NTREL202.ntdev.corp.microsoft.com\34FB5F65-FFEB-4B61-BF0E-A6A76C450FAA\Tra...
USERDOMAIN                     xah-PC
USERNAME                       xah
USERPROFILE                    C:\Users\xah
windir                         C:\Windows

One of the most important env var is the PATH. Here's a sample value of path as set in my system (with line break added for easy reading):

C:\Program Files (x86)\Java\jdk1.6.0_14\bin;
c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;
c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;
c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;
C:\Program Files (x86)\QuickTime\QTSystem\

Local vs System env vars

A env var can be Local or System. Local means per session, temporary. System means permanent. System env vars are also grouped into User and Machine groups.

Local = Process env var = Per Session = Temporary

Local env var are created by a command shell (cmd.exe or PowerShell).

Local env var are also known as “Process env var”. They are per session env vars. They are temporary.

When you use “set” in cmd.exe to create set a variable, it creates a local env var. When you restart the shell, they are gone.

When programs are launched from the shell, they get all env vars including Process category env vars.

System env vars = User and Machine = Permanent/Registry

System env var are those stored in Windows Registry. They are permanent.

System env var can be created by a command line shell or programing language.

System env vars has 2 categories: User and Machine.


The “User” category env vars are things like home dir (HOME), temp dir (TEMP and or TMP).

In Registry, they are at:



The “Machine” category env vars are any other, usually related to your machine or more general info. For example: OS kernal path (WINDIR), processor info (PROCESSOR_ARCHITECTURE, NUMBER_OF_PROCESSORS, etc), application paths (PATH), executable file name extensions (PATHEXT), OS type (OS), current user name (USERNAME), etc.

In Registry, they are at:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

For a intro of Registry see: Microsoft Windows Registry Tutorial.

Note that you can set any new env vars in any category. Programs have access to all your env vars, but which ones are meaningful to the program is up to the program.

Using cmd.exe to View or Set Env Var

Viewing Env Var

To show a value of a env var, type “echo %‹env var name›%”. For example, to show the “path” env var, do:

echo %path%

To see all your env vars, type:


To see all env vars starting with “p”, type:

set p

Setting Env Var For Current Session

To set env var for the current session, use “set ‹var name›=‹value›”. WARNING: make sure there's no space around the equal sign. Example:

set xx=5
echo %xx%
REM prints 5. (REM is a comment syntax, everything after it is ignored.)
REM prepending a path to the “path” env var 
set PATH="C:\Program Files (x86)\ErgoEmacs;%PATH%"

Setting Env Var Permanently

To set env var permanently, use “setx” command. The “setx” command is part of cmd.exe in Windows Vista. Here's a example:

REM example of setting HOME env var
setx HOME "C:\Users\mary"
REM example of adding a path
setx PATH "C:\Program Files (x86)\ErgoEmacs;%PATH%"

For detail, type “setx /?”.

Note: when you set a env var using “setx”, it is set in the registry, however, they are not known in the current session. Restart the shell if you want them to be available.

Managing Env Var With Powershell

Using PowerShell to Manage Environment Variables.

technet.microsoft.com Command shell overview

msdn.microsoft.com Environment Methods

Lambda Logo Tour

Perm url with updates: http://xahlee.org/UnixResource_dir/lambda_logo.html

A Lambda Logo Tour

(and why LISP languages using λ as logo should not be looked upon kindly)

Xah Lee, 2002-02, ..., 2010-09-25

Dear lispers,

The lambda character λ, always struck a awe in me, as with other mathematical symbols. In my mind, i imagine that those obscure math symbolism are etched in stone by god. A salient example is the book cover Concrete Mathematics by Ronald Graham et al. amazon

book cover of Concrete Mathematics

Book cover of Concrete Mathematics.

Here we see the summation sign ∑ etched in stone. The summation sign happens to be my favorite math symbol. (chosen as my website signet: XahLee.org signet)

These symbols are not to be trifled with. If anyone puffs in as much half a snicker, i wish god strikes a thunder upon their impudence.

Promote your logo with these custom promotional items for your brand.

The Greek lambda symbol is used in a branch of logic called lambda calculus. The theories of lambda calculus is what functional languages are based on, thus many functional language's logo feature the lambda. Here is a collection of functional language's logos involving the lambda.

✻ ✻ ✻

Mit Scheme lisp logo 2010

MIT Scheme's logo.

MIT Scheme is a grand daddy of Scheme lisp. Its logo features a recursive shield with lambda. http://www.swiss.ai.mit.edu/projects/scheme/

Schemer.org's logo

schemers.org's logo.

This logo has a modern look. It is a simple lambda inside a O figuration. Though, i was told this “O” is supposed to be a pair of parenthesis.

PLT Scheme logo

PLT Scheme's logo.

PLT Scheme's logo, notable is the red/white/blue coloring scheme. PLT Scheme changed its name to Racket in 2010-06. Home page: racket-lang.org.


MzScheme's logo.

MzScheme is part of PLT Scheme. The logo features a lambda besides a Chinese character 文 (wen2). The character means written language.

Common Lisp HTTP server logo

Common Lisp HTTP server web badge. Quite lame and unprofessional.

Scheme Shell logo

Scheme shell scsh logo is a lambda inside a bivalve, perhaps most florid of the bunch: http://www.scsh.net/

Haskell language logo

Haskell language logo in 2002. haskell.org

Haskell logo

Haskell's new logo, inaugurated in 2003-05. It is designed by Fritz Ruehr. Superb.

It is made of 5 math symbols revolving around a big lambda. The symbols are: right arrow →, inverted A ∀, double right-pointing angle bracket ≫, double colon ::, double right arrow ⇒, and lambda λ. The right arrow → signifies transformation. The inverted A ∀ signifies “for all”. The double angle ≫ signifies free from disorder. The double colon :: signifies exactitude. The double right arrow ⇒ signifies generality. Finally, the lambda λ signifies functionality.

Haskell web badge Haskell web badge

Two web badges for Haskell. (For detail, see Haskell Logo.)

Haskell logo7000

Haskell's new logo of 2009.

This logo's concept is based on ASCII art by Darrin Thompson, and interpreted by Jeff Wheeler. It is a result of public logo contest. For detail, and many quality logo entries, see Source.

Hugs98 logo

The Haskell interpreter Hugs98 features a 3D lambda with projected shadow http://www.haskell.org/hugs/

Yale Haskell logo Yale Haskell bullfrog

Yale Haskell project used a logo that features symbols in lambda calculus including the lambda, and also a bullfrog head. Quite funny and beautiful. (the bullfrog logo origin is explained at the bottom. i.e. that of parody to Yale's bulldog logo) http://web.archive.org/web/19990828153125/http://www.cs.yale.edu/haskell/yale-fp.html

cover of Structure and Interpretation of Computer Programs

The book cover of Structure and Interpretation of Computer Programs, by Harold Abelson, Gerald Jay Sussman, features a wizard and witch gesticulating with prominent lambda, and a monster foot of the table showing.

I love these lambda-featuring logos. However, i have a complaint. As most of you know, lisp languages are not purely functional languages. Subroutines in lisps easily have side-effects, and sometimes non-functional programing methodologies such as OOP are actually encouraged in lisp. As most of you know, the lambda symbol chosen by functional languages is to signify no side-effects. In this respect, i find the lisp languages not totally deserving the use of lambda in their logo. As i have expressed before, mathematical symbols are not to be trifled with, and the Schemers have tainted my mathematics, strictly speaking.

Although i have this minor objection with lispers using the lambda symbol, but overall i think the lispers and i share a more important common goal. That is, to kill all imperative programing ignoramuses of the world. Once the unix and C and Perl and otherwise idiots are all dead, then i'll formally raise my objection about Lisper's unfit borrowing of the lambda symbol.

✻ ✻ ✻

Addendum, 2003-05, ..., 2010-09-25


PFP logo, by Martin Erwig.

The PFP library for Haskell features a lambda disguised as a histogram. One of the most well-designed among lambda logos. (“A Probabilistic Functional Programming Library for Haskell” by Martin Erwig and Steve Kollmansberger, 2005. http://web.engr.oregonstate.edu/~erwig/pfp/).

FC++ logo

Logo for FC++ by Brian Dickens.

Someone has written a C++ library for functional programing, called FC++. (by Brian McNamara and Yannis Smaragdakis, 2003) Website: http://www.cc.gatech.edu/~yannis/fc++/index.html.

Scheme Chicken logo

Chicken Scheme logo.

Chicken Scheme features a logo that is a lambda inside a hen silhouette. (by Felix L Winkelmann, at call-cc.org).

This is getting silly and disrespectful.

chicken scheme logo chicken4-low

Chicken's new logos, by Moe Aboulkheir et al. Left as of 2007-03, right as of 2009-06.

I prefer the original yellow hen logo. This new modern looking logo lost it's chicken attraction. You can't easily tell what bird it is, and the funky lambda takes some tech geeking to recognize. The original logo of the fat hen signifies birth, with lambda right in its tummy.

For some history of CHICKEN scheme's logo, see Source.

Qi logo

A Qi (programming language) logo designed by yours truely. For detail, see: Qi Language Logo.


Logo of Clojure, a new Lisp lang in Java Virtual Machine. The logo is designed by Tom Hickey with input from Rich Hickey. A SVG version is here: File:Clojure-glyph.svg

Non-Lambda Logos

Here's some collection of lisp logos that does not involve lambda.

LISP logo

Classic twisty lisp. For different sizes and SVG format, see LISP Logo.

CLforJava logo

CLforJava logo.

CLforJava is a Common Lisp implementation on Java Virtual Machine. Home page: clforjava.org.

Clozure Common Lisp logo

Clozure Common Lisp logo.

Clozure Common Lisp is formally OpenMCL, which is derived from Macintosh Common Lisp (MCL). Home page is at: https://www.ohloh.net/p/ccl.