Environment variables are values that a program can use to learn information about the system. There are three types of environment variables that apply at the system, user, and process levels. As you may guess from their names, system-level variables apply to all processes started on the system, user-level variables apply to processes started by a particular user, and process-level variables apply to a particular process and any other processes that it starts.
Environment variables may indicate such things as the name of the operating system, the location of temporary directories, the user’s name, and the number of processors the system has. You can also store configuration information in environment variables for your programs to use.
Environment variables are loaded when a process starts, and they are inherited by any process launched by the initial process. During Visual Basic development, that means the variables are loaded when you start Visual Studio and they are inherited by the program you are working on when you start it. If you make changes to the system’s environment variables, you need to close and reopen Visual Studio before your program will see the changes.
A program can also create temporary process-level variables that are inherited by launched processes and that disappear when the original process ends.
Visual Basic provides a couple of tools for working with the application’s environment. The following sections describe two: the Environ function ...