Environment Variables


Environment variables

Environment variables are used in Windows to store some settings relating to the operation operating system or installed applications.

They are used in all major operating systems (not just Windows) and some of them are particularly useful to interact simple and efficient with your personal computer. In the definition of Microsoft, the environment variables are :

strings of characters contain information such as file paths, drives, or names of file

They can be used to control the behavior of different programs.

For example, the “TEMP” environment variable can specify the directory in which installed applications will be able to save any temporary files.

The values of some environment variables are set during booting the operating system. Usually, the variables are initialized by Windows with default values.

To use the environment variables from the command line or from a any script,
you must enclose two percentage signs.

  • Example1
    • Click Start -> Run
    • Digit %TEMP%, … (Whatever is the version of Windows you have, or already in the Search box programs and files in the Windows Start menu 7)
    • Press Enter
    • The operating system shell will open up a window with the contents of the folder used to store temporary files.

  • Example2
    • Click Start -> Run
    • Type cmd
    • Press Enter
    • Write SET TEMP at the prompt, you receive the correct value for TEMP environment variable. Alternatively you can use a TEMP and TMP: the result will be identical.

In Windows XP, right-clicking with the mouse icon “My Computer” and selecting “Properties”, clicking on “Advanced tab”, then click “Environment Variables”, you can get the list of configured variables, whether the user than those of the system.

A similar operation can be performed in the case of Windows 7 clicking the “Start” button with the right mouse button on the “Voice Computer”, click “Properties”, “Advanced System Settings” link click the “Advanced tab” and the “Environment Variables” button.

This is the official Microsoft Page lists all the environment variables used in Windows.

We list below only those which are used by typing directly in Start, Run … or in any window Windows dialog. For example, clicking on Start, Run … then typing “%userprofile%” you can quickly open the folder contains the profile of the currently logged on.

As usual, typing “Start -> Run -> cmd” and then “SET USERPROFILE” you will get the folder contained in the environment variable (in the case of Windows 7, is usually C:\Users\username on Windows XP as C:\Documents and Settings\username).

  • %ALLUSERSPROFILE% – Back to the folder containing the information common between the different profiles of user accounts created on your system.
  • %APPDATA% – Folder where the various Windows applications usually store settings and configuration files.
  • % COMPUTERNAME% – Returns the assigned name to your system.
  • %SYSTEMDRIVE% – Returns the ID (drive letter) for the associated storage (Hard Disk) where you installed the system operational, normally the drive letter is “C:/”
  • %SYSTEMROOT% – Refers to the directory where you installed the operating system (eg C: \ WINDOWS).
  • %TEMP% and %TMP% – The directory where temporary files are stored by part of the operating system and installed applications. Usually, the contents of this folder can be deleted periodically in order to recover disk space.
  • %USERNAME% – Provides the user account name.
  • %USERPROFILE% – Provides access to the folder containing the files linked to the profile of the currently logged in Windows. This folder also contains the system directory Documents, My Pictures, Music, Video, and so
    on.
  • %WINDIR% – Returns the folder containing the operating system.

For further information please follow this official Microsoft Page .

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: