Enviroment Variables
What Are Environment Variables?
Environment Variables are stored in a small area of memory available to all programs running within or on top of the DOS environment (including Windows). They are called “variables” because they can be changed. In fact, some variables need to be reestablished after every reboot.
Variable names are NOT case sensitive within Windows.
For the Ruby language, Facter stores and retrieves "facts" from operating systems.
If you have the permissions, invoke, then open my DOS batch file 1envvars.bat which lists the values of these variables on your computer
Windows resolves commands typed in the start/run box first from files in %SYSTEMDRIVE%, then files in %SYSTEMROOT%. This is regardless of the systemdrive (such as E:) being later in the path. This means that a rogue file can be invoked instead of a good file (such as cmd.exe) if it's in the %SYSTEMDRIVE%.
Below are dynamic environment variables:
You can quickly reach the folder specified within an environment variable by typing that variable on the Address bar of Windows Explorer:
User Environment Variables Added by Applications
User environment variables are stored in Windows Registry HKEY_CURRENT_USER\Environment
Within a command batch file, to list Oracle Environment Variables
echo ORACLE_SID = %ORACLE_SID%
echo ORACLE_HOME = %ORACLE_HOME%
echo ORA_NLS = %ORA_NLS%
echo.
echo PATH = %PATH%
echo.
echo Machine Name to messenger service:
net name
Novell adds these environment variables during installation.
Creating Variables on Windows
Environment Variables can be created and changed using several mechanisms:
By Windows automatically upon boot-up.
By application programs using Windows OS API functions. This is commonly done by application installation programs.
Manually using GUI in System Properties, Advanced tab, Environment Variable button. Get to this one of two ways: a). right-click My Computer icon, select Properties,
b). click Start > Control Panel > System icon
Click the Advanced tab, New for a new variable or Edit for an existing variable listed.
System variables are available to all users.
Manually using commands typed into the DOS Command Window obtained one of two ways:
a). click
Programs | Accessories | Command Prompt
b). click
Run..., type cmd and press Enter.
To see all variables, type:
SET
Windows uses a tilde ~ character to substitute for parts of file and folder names longer than 8 characters.
To use the SET command to define a single variable:
SET CLASSPATH=.;path1
The dot specifies the current directory. The semicolon separates two folders. If the variable was already established, this will replace its value.
To add a value in front of the existing value, refer to itself:
SET CLASSPATH=path1;%CLASSPATH%
Variables created with SET are only valid for the current session and will not be available after the command window is closed or the computer reboots.
By commands executed from within an AUTOEXEC.BAT file or host script file
run this sample logon.bat file. (Click Open when prompted. Your firewall may -- rightfully -- block this.)