15.1. Access Runtime Environment Information

Problem

You need to access information about the runtime environment and platform in which your application is running.

Solution

Use the members of the System.Environment class.

How It Works

The Environment class provides a set of Shared members that you can use to obtain (and in some cases modify) information about the environment in which an application is running. Table 15-1 describes some of the most commonly used Environment members.

Table 15.1. Commonly Used Members of the Environment Class
MemberDescription
Properties 
CommandLineGets a String containing the command line used to execute the current application, including the application name. (See recipe 1-7 for details.)
CurrentDirectoryGets and ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.