Windows 7 Environment Variables in Windows 7

The following are Environment Variables in Windows 7 which can allow you to get to system locations more efficiently.

What are Environment Variables in Windows?

Well, if we understand that "variables" are things that can be changed, and if we also understand that the environment that variables are in, in this case, consists of Microsoft Windows, then we can understand that Environment Variables allow you to access common system locations and even functions even if they have been programmed to be located in different areas or on different drives. For example, your user profile may not be on Drive C, so to get to it, you could use the environmental variable %HOMEPATH% to get to your User Profile data.

Environmental Variables are also very useful in basic scripting and other uses. You may find a need to use them at some time or other.

You can add your own Environment Variables in Windows 7 by going to:


  • Start -> Search -> Environment

From here you can select two options:


  • Edit environment variables for your account
  • Edit the system environment variables

Changes to account variables are not universal for the system, while changing or adding system environment variables are.

Easy to Use/Program Environment Variables

%ALLUSERSPROFILE%
C:\ProgramData

%APPDATA%
C:\Users\(username}\AppData\Roaming
%CommonProgramFiles%
C:\Program Files\Common Files

%CommonProgramFiles(x86)%
Only available in 64-bit (x64) OS, and point to Common Files directory in 32-bit Program Files.

%COMPUTERNAME%
{computername}

%COMSPEC%
C:\Windows\System32\cmd.exe

%HOMEDRIVE%
C:

%HOMEPATH%
\Users\{username}

%LOCALAPPDATA%
C:\Users\{username}\AppData\Local

%PATH%
Varies. Includes C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem

%PATHEXT%
.COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH; .MSC

%ProgramData%
C:\ProgramData

%PROGRAMFILES%
Directory containing program files, usually C:\Program Files

%ProgramFiles(x86)%
In 64-bit systems, directory containing 32-bit programs. Usually C:\Program Files (x86)
%PROMPT% Code for current command prompt format. Code is usually $P$G
%Public% C:\Users\Public

%SYSTEMDRIVE%

The drive containing the Windows root directory, usually C:

%SYSTEMROOT%
The Windows root directory, usually C:\Windows

%TEMP% and %TMP%
C:\Users\{Username}\AppData\Local\Temp

%USERNAME%
{username}

%USERPROFILE%

C:\Users\{username}

%WINDIR%
C:\Windows

Common Programming, Scripting, and Server Environment Variables

%CD%

For command-line. Display current working directory or folder.

%ComSpec%
Display full path to the command-line

%Date%
Scripting. Display current date in regional format.

%ErrorLevel%
Point to current error level, normally used to check error returned from previous command.

%HomeDrive%

Point to the drive for current signed on user’s home folder. {SystemDrive}:\ {SystemDrive}:\

%LogonServer%

Hold the hostname of the server that authenticated the current user’s logon credentials. Windows Server.

%Path%
Contains a semicolon-delimited list of directories in which the command interpreter will search for executable files.

%PathExt%
Contains a semicolor-delimited list of extensions which are defined as exectable.

%Prompt%
Display code for current command prompt format. $P$G $P$G

%Random%

Return a random number between 0 and 32767.

%Time%
Display current time in regional format.

%UserDomain%
Hold the name of the Workgroup or Windows Domain to which the current user belongs.

These are often sometimes referred to as "Environmental Variables" under Windows.
 
How do you see Environment variables in Windows 7? I am setting values and they don't show up either in Computer->Properties or in the Registry.
 
Back
Top