You want to retrieve information from a Windows environment variable (for example, to find out the computer name, username, logon server, and so on).
Use the GetEnvironmentVariable or GetEnvironmentVariables methods of the System.Environment class.
The Windows operating system stores some commonly used information in environment variables. You can access this information by using the Environment.GetEnvironmentVariable method and supplying the name of the variable. The following code snippet uses this technique to retrieve the name of the current computer:
Dim ComputerName As String ComputerName = Environment.GetEnvironmentVariable("COMPUTERNAME")
Applications can define and set their own environment ...