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.

Windows System Environment Variables

    • These system environment variables are automatically created by Windows upon boot-up in Windows Registry key HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\ Environment

Go to Top of this page.
Next topic this page
tool
    • 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:

Reminder
    • You can quickly reach the folder specified within an environment variable by typing that variable on the Address bar of Windows Explorer:

Go to Top of this page.
Set this at top of window.
Previous topic this page

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.

another page on this site
Next topic this page
Set this at top of window.

Creating Variables on Windows

  • Environment Variables can be created and changed using several mechanisms:

      1. By Windows automatically upon boot-up.

      2. 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

        1. Click the Advanced tab, New for a new variable or Edit for an existing variable listed.

System Properties tabs
System Variable Input dialog
reminder
        1. System variables are available to all users.

    1. 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.

        1. To see all variables, type:

        • SET

          • Windows uses a tilde ~ character to substitute for parts of file and folder names longer than 8 characters.

        1. To use the SET command to define a single variable:

        • SET CLASSPATH=.;path1

        1. The dot specifies the current directory. The semicolon separates two folders. If the variable was already established, this will replace its value.

        2. To add a value in front of the existing value, refer to itself:

        • SET CLASSPATH=path1;%CLASSPATH%

caution
        1. 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.

another page on this site
tool