Table of Contents
Windows - Environment Variable
About
An environment variable is an operating system variable that use the hosted application to set application parameters.
They can be set on different scopes:
- for a shell thread in a DOS command
- for a specific user
- global for a system
Articles Related
How to set a environment variable ?
In a DOS command
set PATH=%PATH%;C:\NiewDirectory\AndSubDirectory;
In a DOS command, the value is only available for this shell/window. Once the DOS windows/command is closed, the modified value is no more applied.
With the Windows GUI
- Start / Control Panel / (Performance and Maintenance for XP) / System
- In the Advanced tab, click the Environment Variable button
- You can enter a environment variable for:
- a user session
- of for the complete system (also known as a global environment variable)
How to read a environment variable ?
From a command dos
Open a Command Prompt and tape echo %ENVIRONMENT_VARIABLE_NAME%.
Example
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\>echo %TEMP% C:\DOCUME~1\NICOLA~1.GER\LOCALS~1\Temp
Example of environment variable
| %PATH% | list of directories where the OS search to find executable binary |
| %temp% | Temp Directory |
| %SYSTEMDRIVE% | Disk Drive |
