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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.