O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.3. Querying the Environment

Let's implement a small program to query the local machine environment about the user, processes running on the machine, and the logical drives associated with the machine. Our output looks like this:

 Hello, stanley lippman! Your machine PROUST is running Microsoft Windows NT 5.0.0.2195 Service Pack 1 The current process running is 'HelloEnvironment' Startup Path is C:\C#Programs\HelloEnvironment\bin\Debug There are 46 other processes running on PROUST Process Name: Idle has been running for 3 days total: 3.22:59:33.0130432 Machine PROUST Process Statistics Longer than a day: 1 Longer than an hour: 0 Longer than a minute: 12 Less than a minute: 34 The logical drive subdirectory structure: A:\ :: 2 subdirectories. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required